diff --git a/CMakeLists.txt b/CMakeLists.txt index 80a06fc8df9ebe342d13de53ecd5eebf2b93f86a..36c6831d568138dd51d5160e8dc1f3544ec3caf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1001,19 +1001,25 @@ endif() option ( WALBERLA_THREAD_SAFE_LOGGING "Enables/Disables thread-safe logging" ON ) if ( WALBERLA_BUILD_WITH_OPENMP ) - if ( WALBERLA_CXX_COMPILER_IS_NEC ) - add_flag ( CMAKE_C_FLAGS "-Popenmp" ) - add_flag ( CMAKE_CXX_FLAGS "-Popenmp" ) + find_package( OpenMP ) + if (OpenMP_FOUND) + add_flag ( CMAKE_C_FLAGS "${OpenMP_C_FLAGS}" ) + add_flag ( CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}" ) + list ( APPEND SERVICE_LIBS ${OpenMP_CXX_LIBRARIES} ) else() - find_package( OpenMP ) - add_flag ( CMAKE_C_FLAGS "${OpenMP_C_FLAGS}" ) - add_flag ( CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}" ) - list ( APPEND SERVICE_LIBS ${OpenMP_CXX_LIBRARIES} ) + #workarounds + if ( WALBERLA_CXX_COMPILER_IS_NEC ) + message( STATUS "Enabling OpenMP workaround for NEC") + add_flag ( CMAKE_C_FLAGS "-Popenmp" ) + add_flag ( CMAKE_CXX_FLAGS "-Popenmp" ) + else() + message(FATAL_ERROR "Could NOT enable OpenMP") + endif() endif() else() if ( WALBERLA_CXX_COMPILER_IS_CRAY ) - add_flag ( CMAKE_C_FLAGS "-h noomp" ) - add_flag ( CMAKE_CXX_FLAGS "-h noomp" ) + add_flag ( CMAKE_C_FLAGS "-h noomp" ) + add_flag ( CMAKE_CXX_FLAGS "-h noomp" ) endif() endif() ############################################################################################################################