Tests/FortranModules: add a test for iface Fortran sources

This tests that a library that doesn't compile Fortran sources but
provides one via `INTERFACE` sources works as intended.
This commit is contained in:
Ben Boeckel
2023-09-18 20:21:02 -04:00
committed by Brad King
parent e3d511fb9c
commit d870a47e23
5 changed files with 38 additions and 0 deletions

View File

@@ -133,3 +133,4 @@ if( # Intel Fortran VS Integration breaks on custom targets with Fortran sources
add_subdirectory(Issue25252)
add_subdirectory(Issue25252-iface-target)
endif()
add_subdirectory(Issue25252-iface-sources)

View File

@@ -0,0 +1,9 @@
enable_language(C)
add_library(fortran_source_iface_sources STATIC lib.c)
target_sources(fortran_source_iface_sources
INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/iface.f90")
add_library(lib25252-iface-sources lib.f90)
target_link_libraries(lib25252-iface-sources PRIVATE fortran_source_iface_sources)

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,4 @@
int f()
{
return 0;
}

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