Tests/FortranModules: add test for TARGET_OBJECTS-as-linked-items module usage

Test module usage across a `$<TARGET_OBJECTS>`-as-linked-items use case.

See: #25425
This commit is contained in:
Ben Boeckel
2023-11-17 10:53:34 -05:00
parent 7c1e52be87
commit 9d2769ecbd
10 changed files with 69 additions and 0 deletions

View File

@@ -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)

View File

@@ -0,0 +1,3 @@
pure real function dummy()
dummy = 4*atan(1.)
end function

View File

@@ -0,0 +1,11 @@
module m1
implicit none
contains
pure real function pi()
pi = 4*atan(1.)
end function
end module m1

View File

@@ -0,0 +1,13 @@
module lib
use m1, only : pi
implicit none
contains
pure real function func()
func = pi()
end function
end module