summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-02-28 16:36:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-02-28 16:36:10 (GMT)
commitfb377ab5ef36f285231670929a5d4d2e4dc30515 (patch)
tree66aae3b219721ed213f72f0ce8cec94f88e29d0c /Modules
parentd65a6dd8977a832cf175630a9dc7b30a57af109d (diff)
parent8e2683cf6db078b33cf0d5162c1a72b6f553b0be (diff)
downloadCMake-fb377ab5ef36f285231670929a5d4d2e4dc30515.zip
CMake-fb377ab5ef36f285231670929a5d4d2e4dc30515.tar.gz
CMake-fb377ab5ef36f285231670929a5d4d2e4dc30515.tar.bz2
Merge topic 'FortranCInterface-cross-compile'
8e2683cf6d FortranCInterface: Fix broken search for test exe when cross-compiling Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4404
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt4
-rw-r--r--Modules/FortranCInterface/Detect.cmake10
2 files changed, 6 insertions, 8 deletions
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index 381080b..13e4498 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -101,3 +101,7 @@ set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
# Require symbols through Fortran.
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
target_link_libraries(FortranCInterface PUBLIC symbols)
+
+file(GENERATE OUTPUT exe-$<CONFIG>.cmake CONTENT [[
+set(FortranCInterface_EXE "$<TARGET_FILE:FortranCInterface>")
+]])
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 33de6c6..c75067b 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -43,17 +43,11 @@ set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
# Locate the sample project executable.
+set(FortranCInterface_EXE)
if(FortranCInterface_COMPILED)
- find_program(FortranCInterface_EXE
- NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
- PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Release
- NO_DEFAULT_PATH
- )
- set(FortranCInterface_EXE ${FortranCInterface_EXE})
- unset(FortranCInterface_EXE CACHE)
+ include(${FortranCInterface_BINARY_DIR}/exe-Release.cmake OPTIONAL)
else()
set(_result "Failed to compile")
- set(FortranCInterface_EXE)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Fortran/C interface test project failed with the following output:\n"
"${FortranCInterface_OUTPUT}\n")