Skip to content

Commit

Permalink
cmake: build with libm
Browse files Browse the repository at this point in the history
  • Loading branch information
ethomson committed Jan 19, 2025
1 parent 8c24def commit 3cf1322
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ set_target_properties(clar PROPERTIES
C_EXTENSIONS OFF
)

if(NOT WIN32)
set(CLAR_LIBRARIES m)
endif()

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
if(BUILD_TESTING)
Expand Down
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ target_include_directories(example PRIVATE
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_libraries(example clar)
target_link_libraries(example clar ${CLAR_LIBRARIES})
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ target_include_directories(selftest PRIVATE
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_libraries(selftest clar)
target_link_libraries(selftest clar ${CLAR_LIBRARIES})

add_test(NAME build_selftest_suite
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --target selftest_suite
Expand Down
2 changes: 1 addition & 1 deletion test/selftest_suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ target_include_directories(selftest_suite PRIVATE
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_libraries(selftest_suite clar)
target_link_libraries(selftest_suite clar ${CLAR_LIBRARIES})

0 comments on commit 3cf1322

Please sign in to comment.