diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-09-19 00:21:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-20 13:18:01 (GMT) |
commit | d870a47e2382b15e66f2ef1990415e37d7723e25 (patch) | |
tree | 9856ec7ebb71215d5fac850bbf63570bea8c792e | |
parent | e3d511fb9ca895bcf5aa74640e4a5df640bf9503 (diff) | |
download | CMake-d870a47e2382b15e66f2ef1990415e37d7723e25.zip CMake-d870a47e2382b15e66f2ef1990415e37d7723e25.tar.gz CMake-d870a47e2382b15e66f2ef1990415e37d7723e25.tar.bz2 |
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.
5 files changed, 38 insertions, 0 deletions
diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 895c14c..00f3e57 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -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) diff --git a/Tests/FortranModules/Issue25252-iface-sources/CMakeLists.txt b/Tests/FortranModules/Issue25252-iface-sources/CMakeLists.txt new file mode 100644 index 0000000..574435f --- /dev/null +++ b/Tests/FortranModules/Issue25252-iface-sources/CMakeLists.txt @@ -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) diff --git a/Tests/FortranModules/Issue25252-iface-sources/iface.f90 b/Tests/FortranModules/Issue25252-iface-sources/iface.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/Issue25252-iface-sources/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/Issue25252-iface-sources/lib.c b/Tests/FortranModules/Issue25252-iface-sources/lib.c new file mode 100644 index 0000000..6ccdb8d --- /dev/null +++ b/Tests/FortranModules/Issue25252-iface-sources/lib.c @@ -0,0 +1,4 @@ +int f() +{ + return 0; +} diff --git a/Tests/FortranModules/Issue25252-iface-sources/lib.f90 b/Tests/FortranModules/Issue25252-iface-sources/lib.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/Issue25252-iface-sources/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 |