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

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

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

View File

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

View File

@@ -0,0 +1 @@
add_library(mvstos_obj OBJECT obj.f90)

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