Skip to content

Commit

Permalink
make target link libraries (m and OpenMP) private
Browse files Browse the repository at this point in the history
  • Loading branch information
gschramm committed Feb 15, 2023
1 parent d8145ad commit 85463d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ set_target_properties(parallelproj_c PROPERTIES PUBLIC_HEADER "include/parallelp
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
message(STATUS "linking against libm")
target_link_libraries(parallelproj_c PUBLIC ${MATH_LIBRARY} OpenMP::OpenMP_C)
target_link_libraries(parallelproj_c PRIVATE ${MATH_LIBRARY} OpenMP::OpenMP_C)
else()
target_link_libraries(parallelproj_c PUBLIC OpenMP::OpenMP_C)
target_link_libraries(parallelproj_c PRIVATE OpenMP::OpenMP_C)
endif()

install(TARGETS parallelproj_c EXPORT parallelprojTargets
Expand All @@ -39,4 +39,5 @@ if(PARALLELPROJ_BUILD_WITH_IDL_WRAPPERS)
endif()

# add the test executables
add_subdirectory(tests)
add_subdirectory(tests)

3 changes: 2 additions & 1 deletion cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target_include_directories(parallelproj_cuda PUBLIC
)

# we have to add the openmp library to be linked
target_link_libraries(parallelproj_cuda PUBLIC OpenMP::OpenMP_CXX)
target_link_libraries(parallelproj_cuda PRIVATE OpenMP::OpenMP_CXX)

install(TARGETS parallelproj_cuda EXPORT parallelprojTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand All @@ -76,3 +76,4 @@ endif()

# add test executables
add_subdirectory(tests)

0 comments on commit 85463d7

Please sign in to comment.