Skip to content

Commit

Permalink
Merge branch 'mmuetzel-cmake' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
tzwinger committed Jul 15, 2024
2 parents 6c7258f + c9d555c commit 2db9e43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 218 deletions.
46 changes: 9 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,46 +164,18 @@ IF(WITH_EXTOPTIM)
ENDIF()

IF(WITH_OpenMP)
# Advanced properties
MARK_AS_ADVANCED(
OpenMP_C_FLAGS
OpenMP_Fortran_FLAGS
OpenMP_CXX_FLAGS
)
FIND_PACKAGE(OpenMP REQUIRED)

# Add OpenMP flags to compilation flags
# if(APPLE)
# if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# set(OpenMP_C "${CMAKE_C_COMPILER}")
# set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
# set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
# set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
# set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
# set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
# endif()
# if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
# set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
# set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
# set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
# set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
# set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
# endif()
# else()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# endif()

# Test compiler support for OpenMP 4.0 features used
INCLUDE(testOpenMP40)
IF(CMAKE_Fortran_COMPILER_SUPPORTS_OPENMP40)
# FIXME: Should link to the CMake targets instead
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

# Set variables for supported OpenMP version
IF(OpenMP_Fortran_VERSION VERSION_GREATER_EQUAL 4.0)
SET(HAVE_OPENMP40 TRUE)
MARK_AS_ADVANCED(HAVE_OPENMP40)
# Test compiler support for advanced OpenMP 4.5 features used
INCLUDE(testOpenMP45)
IF(CMAKE_Fortran_COMPILER_SUPPORTS_OPENMP45)
IF(OpenMP_Fortran_VERSION VERSION_GREATER_EQUAL 4.5)
SET(HAVE_OPENMP45 TRUE)
MARK_AS_ADVANCED(HAVE_OPENMP45)
ENDIF()
Expand All @@ -212,7 +184,7 @@ ENDIF()

# Get rid of the annoying rank mismatch warning
IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.9)
IF(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 9.9)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
# SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
ENDIF()
Expand Down
84 changes: 0 additions & 84 deletions cmake/Modules/testOpenMP40.cmake

This file was deleted.

97 changes: 0 additions & 97 deletions cmake/Modules/testOpenMP45.cmake

This file was deleted.

0 comments on commit 2db9e43

Please sign in to comment.