Skip to content

Commit

Permalink
Fix OpenMP library usage that has a dependency to pthread that break …
Browse files Browse the repository at this point in the history
…conda package usage

Because there is an explicit link to libpthread location that breaks visp conda package usage on linux
we cannot use OpenMP_CXX_LIBRARIES that contains /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.a
by adding:
list(APPEND opt_libs ${OpenMP_CXX_LIBRARIES})
That's why we need to use the modern way to consider pthread dependency
  • Loading branch information
fspindle committed Sep 6, 2023
1 parent cc0782b commit 9209898
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,19 @@ if(USE_ZLIB)
endif()
if(USE_OPENMP)
list(APPEND opt_incs ${OpenMP_CXX_INCLUDE_DIRS})
list(APPEND opt_libs ${OpenMP_CXX_LIBRARIES})
# Because there is an explicit link to libpthread location that breaks visp conda package usage on linux
# we cannot use OpenMP_CXX_LIBRARIES that contains /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.a
# by adding:
# list(APPEND opt_libs ${OpenMP_CXX_LIBRARIES})
foreach(lib_ ${OpenMP_CXX_LIB_NAMES})
if("x${lib_}" STREQUAL "xpthread")
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND opt_libs "${CMAKE_THREAD_LIBS_INIT}")
endif()
else()
list(APPEND opt_libs ${OpenMP_${lib_}_LIBRARY})
endif()
endforeach()
endif()
if(USE_NLOHMANN_JSON)
get_target_property(_inc_dirs "nlohmann_json::nlohmann_json" INTERFACE_INCLUDE_DIRECTORIES)
Expand Down

0 comments on commit 9209898

Please sign in to comment.