summaryrefslogtreecommitdiffstats
path: root/Modules/FortranCInterface/Detect.cmake
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2017-05-05 15:32:52 (GMT)
committerChristian Pfeiffer <cpfeiffer@live.de>2017-05-06 14:36:24 (GMT)
commit2cfea104a632badc453364ec5babf97db7aa01e1 (patch)
treea03f8074ce90ef228fa41a3d647fbadd4204ed3d /Modules/FortranCInterface/Detect.cmake
parenta83250880ad511d92d96bfd860873b9c79c0f462 (diff)
downloadCMake-2cfea104a632badc453364ec5babf97db7aa01e1.zip
CMake-2cfea104a632badc453364ec5babf97db7aa01e1.tar.gz
CMake-2cfea104a632badc453364ec5babf97db7aa01e1.tar.bz2
FortranCInt: Pass CONFIG flags to try_compile
This change ensures that Intel Fortran's /libs: in CMAKE_Fortran_FLAGS and Visual C++'s /MT or /MD in the CMAKE_C_FLAGS_RELEASE do not conflict with each other.
Diffstat (limited to 'Modules/FortranCInterface/Detect.cmake')
-rw-r--r--Modules/FortranCInterface/Detect.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 7612890..7789785 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -27,6 +27,7 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
set(_result)
# Build a sample project which reports symbols.
+set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_COMPILED
${FortranCInterface_BINARY_DIR}
${FortranCInterface_SOURCE_DIR}
@@ -35,6 +36,8 @@ try_compile(FortranCInterface_COMPILED
CMAKE_FLAGS
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
+ "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
@@ -43,7 +46,7 @@ unset(FortranCInterface_COMPILED CACHE)
if(FortranCInterface_COMPILED)
find_program(FortranCInterface_EXE
NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
- PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
+ PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Release
NO_DEFAULT_PATH
)
set(FortranCInterface_EXE ${FortranCInterface_EXE})