From 6e53d74147ef06b9acbd1d3045658cf6cc603a23 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Mon, 23 Jan 2023 19:37:26 +0100 Subject: FindOpenMP: Use OpenMP__INCLUDE_DIR If `OpenMP__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 --- Modules/FindOpenMP.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ) -- cgit v0.12