Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
project(CFS_LC C)

include(CheckSymbolExists)

# Check for "isnan" and "isfinite" is present in "math.h"
set(CMAKE_REQUIRED_LIBRARIES m)
check_symbol_exists(isnan "math.h" HAVE_ISNAN CMAKE_REQUIRED_LIBRARIES)
check_symbol_exists(isfinite "math.h" HAVE_ISFINITE CMAKE_REQUIRED_LIBRARIES)

if (HAVE_ISNAN OR HAVE_ISFINITE)
# Add math library dependency to LC App
message(STATUS "Adding math library dependency to LC App...")
link_libraries(m)
endif()

set(APP_SRC_FILES
fsw/src/lc_custom.c
fsw/src/lc_app.c
Expand Down
9 changes: 8 additions & 1 deletion unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#
##################################################################

# Determine if math library is present
find_library(MATH_LIB_FOUND NAMES m)

add_cfe_coverage_stubs("lc_internal"
utilities/lc_test_utils.c
stubs/lc_app_stubs.c
Expand All @@ -20,7 +23,11 @@ add_cfe_coverage_stubs("lc_internal"
)

# Link with the cfe core stubs and unit test assert libs
target_link_libraries(coverage-lc_internal-stubs ut_core_api_stubs ut_assert)
if (MATH_LIB_FOUND)
target_link_libraries(coverage-lc_internal-stubs ut_core_api_stubs ut_assert m)
else()
target_link_libraries(coverage-lc_internal-stubs ut_core_api_stubs ut_assert)
endif()
Comment thread
jphickey marked this conversation as resolved.

# Include and expose unit test utilities, fsw/inc, and fsw/src includes
target_include_directories(coverage-lc_internal-stubs PUBLIC utilities)
Expand Down
Loading