diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c1a11f..91212f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ if(COLPACK_ENABLE_OPENMP) if(MSVC AND NOT DEFINED OpenMP_RUNTIME_MSVC) set(OpenMP_RUNTIME_MSVC llvm) endif() - find_package(OpenMP REQUIRED) + find_package(OpenMP REQUIRED COMPONENTS CXX) endif() # Define variables to use for organizing the installation. diff --git a/ChangeLog b/ChangeLog index ac4b4dd..b321f3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,7 +10,8 @@ CMake 3.12 or newer is required Options are renamed: ENABLE_EXAMPLES is now COLPACK_ENABLE_EXAMPLES, ENABLE_OPENMP is now COLPACK_ENABLE_OPENMP The recovery routines in src/Recovery are now compiled into the library - OpenMP is linked via OpenMP::OpenMP_CXX, which fixes the build on macOS with libomp from Homebrew + OpenMP is linked via OpenMP::OpenMP_CXX, which fixes the build on macOS with libomp from Homebrew. + Only the CXX component of OpenMP is required, also if a parent project enables C or Fortran MSVC is supported. It builds with /openmp:llvm, because OpenMP 2.0 does not support unsigned loop indices. This requires CMake 3.30 or newer. Windows builds use short intermediate paths (CMAKE_INTERMEDIATE_DIR_STRATEGY=SHORT), because the object paths