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
This commit is contained in:
parent
619aca80ae
commit
978b68d3bb
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
6
Tests/FortranModules/Issue25252/CMakeLists.txt
Normal file
6
Tests/FortranModules/Issue25252/CMakeLists.txt
Normal file
@ -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)
|
5
Tests/FortranModules/Issue25252/custom_target.f90
Normal file
5
Tests/FortranModules/Issue25252/custom_target.f90
Normal file
@ -0,0 +1,5 @@
|
||||
program main
|
||||
|
||||
implicit none
|
||||
|
||||
end program
|
11
Tests/FortranModules/Issue25252/lib.f90
Normal file
11
Tests/FortranModules/Issue25252/lib.f90
Normal file
@ -0,0 +1,11 @@
|
||||
module lib
|
||||
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
pure real function func()
|
||||
func = 1.0
|
||||
end function
|
||||
|
||||
end module
|
Loading…
Reference in New Issue
Block a user