Skip to content

Commit

Permalink
[Build] Modernize cmake openmp usage (Fix preprocessor and library na…
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoulon committed Dec 8, 2021
1 parent 8bab2e8 commit 999d729
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ endif (CXX11_COMPILER)
if (OpenMVG_USE_OPENMP)
find_package(OpenMP)
if (OPENMP_FOUND)
register_definitions(-DOPENMVG_USE_OPENMP)
if(NOT TARGET OpenMP::OpenMP_CXX)
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
Expand All @@ -147,8 +148,8 @@ if (OpenMVG_USE_OPENMP)
# Only works if the same flag is passed to the linker; use CMake 3.9+ otherwise (Intel, AppleClang)
set_property(TARGET OpenMP::OpenMP_CXX
PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
list(APPEND OPENMVG_LIBRARY_DEPENDENCIES ${OpenMP_CXX_FLAGS})
endif()
list(APPEND OPENMVG_LIBRARY_DEPENDENCIES OpenMP::OpenMP_CXX)
endif (OPENMP_FOUND)
else (OpenMVG_USE_OPENMP)
option(OpenMVG_USE_OPENMP "Use OpenMP for parallelization" OFF)
Expand Down

0 comments on commit 999d729

Please sign in to comment.