diff options
author | Christian Pfeiffer <cpfeiffer@live.de> | 2017-05-08 18:26:17 +0200 |
---|---|---|
committer | Christian Pfeiffer <cpfeiffer@live.de> | 2017-05-08 18:26:17 +0200 |
commit | ec5c6bc9bc9bd4e53f511f18cb2da569ea6508e2 (patch) | |
tree | 8ebf23b3c0a6d0a294047cd82e7067cfc01813e4 /Modules/FindOpenMP.cmake | |
parent | 22d0a83a4cc2188119e008ed346a10f7b0b32f8e (diff) | |
download | cmake-ec5c6bc9bc9bd4e53f511f18cb2da569ea6508e2.tar.gz |
FindOpenMP: Refine list of flags to try
Diffstat (limited to 'Modules/FindOpenMP.cmake')
-rw-r--r-- | Modules/FindOpenMP.cmake | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index e7d9d5fd5c..cb31a61d34 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -76,10 +76,10 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST function(_OPENMP_FLAG_CANDIDATES LANG) if(NOT OpenMP_${LANG}_FLAG) - set(OpenMP_FLAG_CANDIDATES "") + unset(OpenMP_FLAG_CANDIDATES) set(OMP_FLAG_GNU "-fopenmp") - set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5") + set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") @@ -92,16 +92,21 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_MIPSpro "-mp") set(OMP_FLAG_MSVC "-openmp") set(OMP_FLAG_PathScale "-openmp") + set(OMP_FLAG_NAG "-openmp") + set(OMP_FLAG_Absoft "-openmp") set(OMP_FLAG_PGI "-mp") set(OMP_FLAG_SunPro "-xopenmp") set(OMP_FLAG_XL "-qsmp=omp") # Cray compiles with OpenMP automatically + set(OMP_FLAG_Cray " ") + # If we know the correct flags, use those if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) - list(APPEND OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + set(OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + # Fall back to reasonable default tries otherwise + else() + set(OpenMP_FLAG_CANDIDATES "-openmp" "-fopenmp" "-mp" " ") endif() - - list(APPEND OpenMP_FLAG_CANDIDATES " ") set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE) else() set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_${LANG}_FLAG}" PARENT_SCOPE) |