Try fixing -lm in cmake
@@ -9,13 +9,17 @@ find_package(CMocka REQUIRED)
message(STATUS "CMocka vars: ${CMOCKA_LIBRARIES} ${CMOCKA_INCLUDE_DIR}")
+find_library(MATH_LIBRARY m)
+
foreach (TEST ${TESTS})
string(REGEX REPLACE ".*/([^/]+).c" "\\1" NAME ${TEST})
message("Adding test ${NAME}")
add_executable(${NAME} "${NAME}.c" assertions.c stream_expectations.c)
target_link_libraries(${NAME} ${CMOCKA_LIBRARIES})
target_link_libraries(${NAME} cbor)
- target_link_libraries(${name} PRIVATE m)
+ if(MATH_LIBRARY)
+ target_link_libraries(${NAME} ${MATH_LIBRARY})
+ endif()
target_include_directories(${NAME} PUBLIC ${CMOCKA_INCLUDE_DIR})
# See https://stackoverflow.com/a/10824578/499521
ADD_TEST(ctest_build_test_${NAME}
