summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmComputeLinkInformation.cxx5
-rw-r--r--Tests/FortranModules/CMakeLists.txt4
-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
5 files changed, 29 insertions, 2 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4804565..7d3675e 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -539,8 +539,9 @@ bool cmComputeLinkInformation::Compute()
this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
- this->Target->HaveCxx20ModuleSources() ||
- this->Target->HaveFortranSources())) {
+ (this->Target->CanCompileSources() &&
+ (this->Target->HaveCxx20ModuleSources() ||
+ this->Target->HaveFortranSources())))) {
return false;
}
diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt
index f5b2822..8ebd9b2 100644
--- a/Tests/FortranModules/CMakeLists.txt
+++ b/Tests/FortranModules/CMakeLists.txt
@@ -128,3 +128,7 @@ endif()
add_subdirectory(Issue25112)
add_subdirectory(Issue25223)
+if( # Intel Fortran VS Integration breaks on custom targets with Fortran sources
+ NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ add_subdirectory(Issue25252)
+endif()
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