Check OpenMP target in CMake (issue #3751)

This commit is contained in:
Transporter 2022-02-09 10:12:14 +01:00
parent acd6f6c93f
commit c2a69a62af

View File

@ -292,7 +292,9 @@ if(OPENMP_BUILD)
if(OpenMP_FOUND)
message(">> OpenMP_FOUND ${OpenMP_FOUND} ${OpenMP_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
if (NOT TARGET OpenMP::OpenMP_CXX)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
endif()
endif()
# https://stackoverflow.com/questions/12399422
# how-to-set-linker-flags-for-openmp-in-cmakes-try-compile-function