summaryrefslogtreecommitdiffstats
path: root/Tests/FortranOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-01 16:47:34 (GMT)
committerBrad King <brad.king@kitware.com>2019-03-01 16:58:21 (GMT)
commit0b82f56ac69f2140cc05e7bdd4564ebf87ea6c6f (patch)
tree0dbedf61f2858d2330871abef0833f4178f3f6b8 /Tests/FortranOnly
parent20a41aa589d4418f9ac46fc8c0402162d1d82873 (diff)
downloadCMake-0b82f56ac69f2140cc05e7bdd4564ebf87ea6c6f.zip
CMake-0b82f56ac69f2140cc05e7bdd4564ebf87ea6c6f.tar.gz
CMake-0b82f56ac69f2140cc05e7bdd4564ebf87ea6c6f.tar.bz2
VS: Fix Fortran target type selection with RC sources
The Intel Fortran `.vfproj` files do support both Fortran and the Windows Resource compiler (`.rc)` files. Prior to CMake 3.9 we did not support that, but commit 2c9f35789d (VS: Decide project type by linker lang as fallback, 2017-03-30, v3.9.0-rc1~340^2) accidentally enabled it. It was then broken by commit d3d2c3cd49 (VS: Fix Fortran target type selection when linking C++ targets, 2019-02-04, v3.14.0-rc1~13^2). Restore support for Fortran+RC in VS projects and add a test case. Fixes: #19002
Diffstat (limited to 'Tests/FortranOnly')
-rw-r--r--Tests/FortranOnly/CMakeLists.txt8
-rw-r--r--Tests/FortranOnly/testRC.rc0
2 files changed, 7 insertions, 1 deletions
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index 77f6041..45372dd 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -12,6 +12,12 @@ add_executable(FortranOnly1 testf.f)
set_property(TARGET FortranOnly1 PROPERTY OUTPUT_NAME FortranOnly)
target_link_libraries(FortranOnly1 FortranOnlylib)
+# Test that Fortran+RC work together.
+# FIXME: Add .rc in more cases.
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(test_rc testRC.rc)
+endif()
+
# create a custom command that runs FortranOnly1 and puts
# the output into the file testfhello.txt
add_custom_command(OUTPUT ${FortranOnly_BINARY_DIR}/testfhello.txt
@@ -20,7 +26,7 @@ add_custom_command(OUTPUT ${FortranOnly_BINARY_DIR}/testfhello.txt
# create a second executable FortranOnly2 that has
# testfhello.txt has an source file so that it will
# run the above custom command.
-add_executable(FortranOnly2 testfhello.txt testf.f)
+add_executable(FortranOnly2 testfhello.txt testf.f ${test_rc})
target_link_libraries(FortranOnly2 FortranOnlylib)
# create a custom target to check the content of testfhello.txt
# by running the cmake script checktestf2.cmake
diff --git a/Tests/FortranOnly/testRC.rc b/Tests/FortranOnly/testRC.rc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/FortranOnly/testRC.rc