summaryrefslogtreecommitdiffstats
path: root/Tests/FortranModules/Issue25252
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-09-18 23:59:56 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-20 13:14:58 (GMT)
commit978b68d3bbb44e3bc6adbe5109eb8295f8232ce6 (patch)
treece2024d7bca4816b4ef41672c3067e48bd0660ac /Tests/FortranModules/Issue25252
parent619aca80ae94b909085344af1098c7f4bf80f0c2 (diff)
downloadCMake-978b68d3bbb44e3bc6adbe5109eb8295f8232ce6.zip
CMake-978b68d3bbb44e3bc6adbe5109eb8295f8232ce6.tar.gz
CMake-978b68d3bbb44e3bc6adbe5109eb8295f8232ce6.tar.bz2
add_custom_target: Fix regression with Fortran sources
Since commit 74b1d6caf3 (cmComputeLinkInformation: compute link info for module-using targets, 2023-09-05, v3.27.5~7^2) we accidentally try to compute link information for custom targets if they have Fortran sources. For module dependencies, we only need to consider target types that can compile. Fixes: #25252
Diffstat (limited to 'Tests/FortranModules/Issue25252')
-rw-r--r--Tests/FortranModules/Issue25252/CMakeLists.txt6
-rw-r--r--Tests/FortranModules/Issue25252/custom_target.f905
-rw-r--r--Tests/FortranModules/Issue25252/lib.f9011
3 files changed, 22 insertions, 0 deletions
diff --git a/Tests/FortranModules/Issue25252/CMakeLists.txt b/Tests/FortranModules/Issue25252/CMakeLists.txt
new file mode 100644
index 0000000..8111c42
--- /dev/null
+++ b/Tests/FortranModules/Issue25252/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_custom_target(custom_target_with_fortran
+ COMMAND "${CMAKE_COMMAND}" -E echo "custom target with fortran sources"
+ SOURCES custom_target.f90)
+
+add_library(lib25252 lib.f90)
+add_dependencies(lib25252 custom_target_with_fortran)
diff --git a/Tests/FortranModules/Issue25252/custom_target.f90 b/Tests/FortranModules/Issue25252/custom_target.f90
new file mode 100644
index 0000000..0528d41
--- /dev/null
+++ b/Tests/FortranModules/Issue25252/custom_target.f90
@@ -0,0 +1,5 @@
+program main
+
+implicit none
+
+end program
diff --git a/Tests/FortranModules/Issue25252/lib.f90 b/Tests/FortranModules/Issue25252/lib.f90
new file mode 100644
index 0000000..a6d7fa6
--- /dev/null
+++ b/Tests/FortranModules/Issue25252/lib.f90
@@ -0,0 +1,11 @@
+module lib
+
+implicit none
+
+contains
+
+pure real function func()
+func = 1.0
+end function
+
+end module