diff options
author | Brad King <brad.king@kitware.com> | 2023-11-27 13:36:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-11-27 13:36:44 (GMT) |
commit | 4b2960b1f3e214dd30b32925b00eef5f64b99b71 (patch) | |
tree | 106a8dc355a73556244ba1701b38faab5181a240 /Tests | |
parent | 66149dd1a93f4f22f68d7465de74b14d7c03f89d (diff) | |
parent | beb1393f8f29302197b80741bec41a13b7f207c7 (diff) | |
download | CMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.zip CMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.tar.gz CMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.tar.bz2 |
Merge topic 'fortran-objects-as-sources-fix' into release-3.28
beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix
a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs
7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets
1175f1c874 LinkItem: track `cmSourceFile` instances for external objects
d2fa56772f Ninja: support "forwarding" modules from other targets
ec1e589bec Ninja: Revert exact collation dependencies for 3.27
06df59b930 cmCommonTargetGenerator: return forward linked target dirs too
f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8989
Diffstat (limited to 'Tests')
23 files changed, 138 insertions, 0 deletions
diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 16ea0d4..1e5ff89 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -137,3 +137,9 @@ add_subdirectory(Issue25252-iface-sources) add_subdirectory(Issue25365-target-objects) add_subdirectory(Issue25365-target-objects-iface) + +# Issue#25425 +add_subdirectory(ModulesViaTargetObjectsSource) +add_subdirectory(ModulesViaSubdirTargetObjectsSource) +add_subdirectory(ModulesViaTargetObjectsLink) +add_subdirectory(ModulesViaSubdirTargetObjectsLink) diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/CMakeLists.txt b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/CMakeLists.txt new file mode 100644 index 0000000..b52b423 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(subdir) + +add_library(mvstol_lib dummy.f90) +target_link_libraries(mvstol_lib PRIVATE "$<TARGET_OBJECTS:mvstol_obj>") +target_include_directories(mvstol_lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/subdir") +add_library(mvstol_use use.f90) +target_link_libraries(mvstol_use PRIVATE mvstol_lib) diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/dummy.f90 b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/dummy.f90 new file mode 100644 index 0000000..96a8138 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/dummy.f90 @@ -0,0 +1,3 @@ +pure real function dummy() +dummy = 4*atan(1.) +end function diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/CMakeLists.txt b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/CMakeLists.txt new file mode 100644 index 0000000..b2a250d --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(mvstol_obj STATIC obj.f90) diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/obj.f90 b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/obj.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/subdir/obj.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/use.f90 b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/use.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsLink/use.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/CMakeLists.txt b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/CMakeLists.txt new file mode 100644 index 0000000..255e8a7 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(subdir) + +add_library(mvstos_lib "$<TARGET_OBJECTS:mvstos_obj>") +target_include_directories(mvstos_lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/subdir") +add_library(mvstos_use use.f90) +target_link_libraries(mvstos_use PRIVATE mvstos_lib) diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/CMakeLists.txt b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/CMakeLists.txt new file mode 100644 index 0000000..acc0da9 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(mvstos_obj OBJECT obj.f90) diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/obj.f90 b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/obj.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/subdir/obj.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/use.f90 b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/use.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/ModulesViaSubdirTargetObjectsSource/use.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/FortranModules/ModulesViaTargetObjectsLink/CMakeLists.txt b/Tests/FortranModules/ModulesViaTargetObjectsLink/CMakeLists.txt new file mode 100644 index 0000000..202e59e --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsLink/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(mvtol_obj STATIC obj.f90) +add_library(mvtol_lib dummy.f90) +target_link_libraries(mvtol_lib PRIVATE "$<TARGET_OBJECTS:mvtol_obj>") +add_library(mvtol_use use.f90) +target_link_libraries(mvtol_use PRIVATE mvtol_lib) diff --git a/Tests/FortranModules/ModulesViaTargetObjectsLink/dummy.f90 b/Tests/FortranModules/ModulesViaTargetObjectsLink/dummy.f90 new file mode 100644 index 0000000..96a8138 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsLink/dummy.f90 @@ -0,0 +1,3 @@ +pure real function dummy() +dummy = 4*atan(1.) +end function diff --git a/Tests/FortranModules/ModulesViaTargetObjectsLink/obj.f90 b/Tests/FortranModules/ModulesViaTargetObjectsLink/obj.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsLink/obj.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/ModulesViaTargetObjectsLink/use.f90 b/Tests/FortranModules/ModulesViaTargetObjectsLink/use.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsLink/use.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/FortranModules/ModulesViaTargetObjectsSource/CMakeLists.txt b/Tests/FortranModules/ModulesViaTargetObjectsSource/CMakeLists.txt new file mode 100644 index 0000000..9113a11 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsSource/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(mvtos_obj OBJECT obj.f90) +add_library(mvtos_lib "$<TARGET_OBJECTS:mvtos_obj>") +add_library(mvtos_use use.f90) +target_link_libraries(mvtos_use PRIVATE mvtos_lib) diff --git a/Tests/FortranModules/ModulesViaTargetObjectsSource/obj.f90 b/Tests/FortranModules/ModulesViaTargetObjectsSource/obj.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsSource/obj.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/ModulesViaTargetObjectsSource/use.f90 b/Tests/FortranModules/ModulesViaTargetObjectsSource/use.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/ModulesViaTargetObjectsSource/use.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json index 45b0396..78f7928 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json @@ -45,6 +45,7 @@ "exports": [], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json index 30b55e3..6c23354 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json @@ -45,6 +45,7 @@ "exports": [], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json index f06a846..61f8f64 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json @@ -73,6 +73,7 @@ ], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json index 938481c..d0263b0 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json @@ -73,6 +73,7 @@ ], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json index 3a66a94..ed61e0e 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json @@ -40,6 +40,7 @@ "exports": [], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json index ac06c0f..171935f 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json @@ -40,6 +40,7 @@ "exports": [], "include-dirs": [], "language": "CXX", + "forward-modules-from-target-dirs": [], "linked-target-dirs": [], "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir<CONFIG_DIR>" } |