Skip to content

Commit

Permalink
link parallelproj_c against libm (using PUBLIC link interface)
Browse files Browse the repository at this point in the history
  • Loading branch information
gschramm committed Dec 30, 2022
1 parent 477b506 commit 2ecde16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 8 additions & 2 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ target_include_directories(parallelproj_c PUBLIC
set_target_properties(parallelproj_c PROPERTIES PUBLIC_HEADER "include/parallelproj_c.h"
SOVERSION ${parallelproj_VERSION})

# we have to add the openmp library to be linked
target_link_libraries(parallelproj_c PUBLIC OpenMP::OpenMP_C)
# link to libm if it exists and against OpenMP_C
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
message(STATUS "linking against libm")
target_link_libraries(parallelproj_c PUBLIC ${MATH_LIBRARY} OpenMP::OpenMP_C)
else()
target_link_libraries(parallelproj_c PUBLIC OpenMP::OpenMP_C)
endif()

install(TARGETS parallelproj_c EXPORT parallelprojTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
7 changes: 1 addition & 6 deletions c/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ target_include_directories(parallelproj_nontof_fwd_back_test PUBLIC
)
target_link_libraries(parallelproj_nontof_fwd_back_test PUBLIC parallelproj_c)

find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
target_link_libraries(parallelproj_nontof_fwd_back_test PUBLIC ${MATH_LIBRARY})
endif()

add_test(NAME parallelproj_nontof_fwd_back_test COMMAND parallelproj_nontof_fwd_back_test)
add_test(NAME parallelproj_nontof_fwd_back_test COMMAND parallelproj_nontof_fwd_back_test)

0 comments on commit 2ecde16

Please sign in to comment.