summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAndrey Alekseenko <al42and@gmail.com>2023-01-23 18:37:26 (GMT)
committerAndrey Alekseenko <al42and@gmail.com>2023-01-23 18:37:26 (GMT)
commit6e53d74147ef06b9acbd1d3045658cf6cc603a23 (patch)
tree7b80a25a5c6ef3c07aa08ee434c6e211dea5c6b2 /Modules
parentf9f34eb11143e5c5c1daee4aa2867139cf930aa4 (diff)
downloadCMake-6e53d74147ef06b9acbd1d3045658cf6cc603a23.zip
CMake-6e53d74147ef06b9acbd1d3045658cf6cc603a23.tar.gz
CMake-6e53d74147ef06b9acbd1d3045658cf6cc603a23.tar.bz2
FindOpenMP: Use OpenMP_<lang>_INCLUDE_DIR
If `OpenMP_<lang>_INCLUDE_DIR` is defined, add it to the list of include directories before checking flags. Previously, this variable was ignored for all compilers but AppleClang, despite the documentation mentioning it as one of the possible inputs. Fixes: #24260
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindOpenMP.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 4aa7d91..68be2d6 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -212,10 +212,14 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
string(APPEND OPENMP_FLAGS_TEST " ${OpenMP_VERBOSE_COMPILE_OPTIONS}")
endif()
string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
+ unset(_includeDirFlags)
+ if(OpenMP_${LANG}_INCLUDE_DIR)
+ set(_includeDirFlags "-DINCLUDE_DIRECTORIES:STRING=${OpenMP_${LANG}_INCLUDE_DIR}")
+ endif()
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
SOURCE_FROM_VAR "${_OPENMP_TEST_SRC_NAME}" _OPENMP_TEST_SRC_CONTENT
LOG_DESCRIPTION "Detecting ${LANG} OpenMP compiler info"
- CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}" ${_includeDirFlags}
LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG}
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
)