diff --git a/CMakeLists.txt b/CMakeLists.txt index 4993f4ae4..40fa47ed9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,9 +187,7 @@ find_package(OpenMP 4.0 QUIET) if (OpenMP_FOUND) message(STATUS "Found OpenMP ${OpenMP_CXX_VERSION} to speed-up library utilities (like file parsing).") set(PLSSVM_FOUND_OPENMP_FOR_UTILITY ON) - if (${CMAKE_CXX_COMPILER_ID} MATCHES "IntelLLVM") - target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -fopenmp) - elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") + if (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") target_compile_options(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -openmp:llvm -openmp:experimental) else () target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC OpenMP::OpenMP_CXX) diff --git a/src/plssvm/backends/OpenMP/CMakeLists.txt b/src/plssvm/backends/OpenMP/CMakeLists.txt index 53f0cdb56..c48d87bfb 100644 --- a/src/plssvm/backends/OpenMP/CMakeLists.txt +++ b/src/plssvm/backends/OpenMP/CMakeLists.txt @@ -40,11 +40,16 @@ set(PLSSVM_OPENMP_SOURCES # set target properties set_local_and_parent(PLSSVM_OPENMP_BACKEND_LIBRARY_NAME plssvm-OpenMP) add_library(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} SHARED ${PLSSVM_OPENMP_SOURCES}) -target_link_libraries(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} PRIVATE $<$>:OpenMP::OpenMP_CXX>) -# special command line options for MSVC: -# -openmp:llvm -> enables unsigned loop indexes in OpenMP parallel for loops -# -openmp:experimental -> enables OpenMP's SIMD instructions -target_compile_options(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} PRIVATE $<$:-openmp:llvm -openmp:experimental>) + +# link against OpenMP +if (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") + # special command line options for MSVC: + # -openmp:llvm -> enables unsigned loop indexes in OpenMP parallel for loops + # -openmp:experimental -> enables OpenMP's SIMD instructions + target_compile_options(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} PRIVATE -openmp:llvm -openmp:experimental) +else () + target_link_libraries(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} PRIVATE OpenMP::OpenMP_CXX) +endif () # additional compilation flags target_compile_options(${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME} PRIVATE $<$:-Wconversion>)