summaryrefslogtreecommitdiffstats
path: root/Tests/VSGNUFortran/runtest.cmake.in
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2011-12-09 23:04:19 (GMT)
committerBrad King <brad.king@kitware.com>2012-02-09 13:33:57 (GMT)
commit538c3452ad660a45c3d6ca32f8c09ee7c93a8b84 (patch)
tree411effeac65ff00e7dfc2d22da9f74906f4f5e52 /Tests/VSGNUFortran/runtest.cmake.in
parent3c6af5ff33a12b3c5603cba06e575fe62e234ce0 (diff)
downloadCMake-538c3452ad660a45c3d6ca32f8c09ee7c93a8b84.zip
CMake-538c3452ad660a45c3d6ca32f8c09ee7c93a8b84.tar.gz
CMake-538c3452ad660a45c3d6ca32f8c09ee7c93a8b84.tar.bz2
Add CMakeAddFortranSubdirectory to use MinGW gfortran in VS
This patch adds a new module that allows for easy integration of MinGW gfortran and the Visual Studio compiler. It is done in a function called cmake_add_fortran_subdirectory. The patch also includes a test for this feature.
Diffstat (limited to 'Tests/VSGNUFortran/runtest.cmake.in')
-rw-r--r--Tests/VSGNUFortran/runtest.cmake.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/VSGNUFortran/runtest.cmake.in b/Tests/VSGNUFortran/runtest.cmake.in
new file mode 100644
index 0000000..987207b
--- /dev/null
+++ b/Tests/VSGNUFortran/runtest.cmake.in
@@ -0,0 +1,23 @@
+get_filename_component(MINGW_PATH "@MINGW_GFORTRAN@" PATH)
+if(NOT EXISTS "${MINGW_PATH}")
+ set(test_exe
+ "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran@CMAKE_EXECUTABLE_SUFFIX@")
+ message("run: ${test_exe}")
+ execute_process(COMMAND "${test_exe}"
+ RESULT_VARIABLE res)
+ if(NOT "${res}" EQUAL 0)
+ message(FATAL_ERROR "${test_exe} returned a non 0 value")
+ endif()
+ return()
+endif()
+file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
+string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
+message("${MINGW_PATH}")
+set(test_exe "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran.exe")
+set(ENV{PATH} "${MINGW_PATH}";$ENV{PATH})
+message("run ${test_exe}")
+execute_process(COMMAND "${test_exe}"
+ RESULT_VARIABLE res)
+if(NOT "${res}" EQUAL 0)
+ message(FATAL_ERROR "${test_exe} returned a non 0 value")
+endif()