summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-10-31 13:12:20 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-10-31 13:12:28 (GMT)
commit3a515b31b39d9eb9c07a39e6da7705cfd1d01f25 (patch)
treea3193b5adf1c74464afcb6d062c78b804e9e371e /Tests
parentd33ea3dff5e36e4e2dea39282f20512a8ec5c87f (diff)
parent22da18b9953f1ec9dff039572b5e8903009e4afb (diff)
downloadCMake-3a515b31b39d9eb9c07a39e6da7705cfd1d01f25.zip
CMake-3a515b31b39d9eb9c07a39e6da7705cfd1d01f25.tar.gz
CMake-3a515b31b39d9eb9c07a39e6da7705cfd1d01f25.tar.bz2
Merge topic 'modules-depends-via-target-objects' into release-3.28
22da18b995 Fortran: Restore support for TARGET_OBJECTS providing modules 64d9240564 cmComputeLinkInformation: skip over linking to items for object purposes 035302b7e3 cmComputeLinkDepends: also copy the target from object link items 861876b936 Tests/ObjectLibrary: fix comment Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: scivision <michael@scivision.dev> Merge-request: !8923
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FortranModules/CMakeLists.txt3
-rw-r--r--Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt11
-rw-r--r--Tests/FortranModules/Issue25365-target-objects-iface/iface.f9011
-rw-r--r--Tests/FortranModules/Issue25365-target-objects-iface/lib.f9013
-rw-r--r--Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt5
-rw-r--r--Tests/FortranModules/Issue25365-target-objects/iface.f9011
-rw-r--r--Tests/FortranModules/Issue25365-target-objects/lib.f9013
-rw-r--r--Tests/ObjectLibrary/CMakeLists.txt2
8 files changed, 68 insertions, 1 deletions
diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt
index 00f3e57..16ea0d4 100644
--- a/Tests/FortranModules/CMakeLists.txt
+++ b/Tests/FortranModules/CMakeLists.txt
@@ -134,3 +134,6 @@ if( # Intel Fortran VS Integration breaks on custom targets with Fortran sources
add_subdirectory(Issue25252-iface-target)
endif()
add_subdirectory(Issue25252-iface-sources)
+
+add_subdirectory(Issue25365-target-objects)
+add_subdirectory(Issue25365-target-objects-iface)
diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt
new file mode 100644
index 0000000..819ac05
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt
@@ -0,0 +1,11 @@
+enable_language(C)
+
+add_library(fortran_target_objects_sources_iface STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90")
+
+add_library(fortran_target_objects_sources_iface_bridge INTERFACE)
+target_sources(fortran_target_objects_sources_iface_bridge
+ INTERFACE
+ "$<TARGET_OBJECTS:fortran_target_objects_sources_iface>")
+
+add_library(lib25365-target-objects-iface lib.f90)
+target_link_libraries(lib25365-target-objects-iface PRIVATE fortran_target_objects_sources_iface_bridge)
diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90
new file mode 100644
index 0000000..6b5ddd5
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects-iface/iface.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/Issue25365-target-objects-iface/lib.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90
new file mode 100644
index 0000000..f971909
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects-iface/lib.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/Issue25365-target-objects/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt
new file mode 100644
index 0000000..64e36cb
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(fortran_target_objects_sources STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90")
+
+add_library(lib25365-target-objects lib.f90 "$<TARGET_OBJECTS:fortran_target_objects_sources>")
diff --git a/Tests/FortranModules/Issue25365-target-objects/iface.f90 b/Tests/FortranModules/Issue25365-target-objects/iface.f90
new file mode 100644
index 0000000..6b5ddd5
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects/iface.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/Issue25365-target-objects/lib.f90 b/Tests/FortranModules/Issue25365-target-objects/lib.f90
new file mode 100644
index 0000000..f971909
--- /dev/null
+++ b/Tests/FortranModules/Issue25365-target-objects/lib.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/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt
index 05a35bb..b57761b 100644
--- a/Tests/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ObjectLibrary/CMakeLists.txt
@@ -68,7 +68,7 @@ add_library(UseCstaticObjs STATIC $<TARGET_OBJECTS:Cstatic> $<TARGET_OBJECTS:A>
# Test a shared library with sources from a different shared library
add_library(UseCsharedObjs SHARED $<TARGET_OBJECTS:Cshared> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>)
-# Test a shared executable with sources from a different shared library
+# Test a shared executable with sources from a different executable
add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>)
target_link_libraries(UseABstaticObjs ABstatic)