Tests/FortranOnly: add a test case for issue #25112

Add a test case for Fortran `OBJECT` libraries providing modules to
consumers.
This commit is contained in:
Ben Boeckel 2023-07-21 16:46:06 -04:00
parent 3ea7204de4
commit 2870a67540
3 changed files with 18 additions and 0 deletions

View File

@ -184,3 +184,9 @@ if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF AND
set_property(TARGET no_preprocess_target PROPERTY Fortran_PREPROCESS OFF)
set_property(SOURCE no_preprocess_source_upper.F no_preprocess_source_fpp.fpp PROPERTY Fortran_PREPROCESS OFF)
endif()
# Issue 25112
set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include")
add_library(objmod OBJECT objmod.f90)
add_executable(objmain objmain.f90)
target_link_libraries(objmain PRIVATE objmod)

View File

@ -0,0 +1,5 @@
program main
use objmod, only : hello
implicit none
call hello()
end program

View File

@ -0,0 +1,7 @@
module objmod
implicit none
contains
subroutine hello()
print '(a)', "hello world"
end subroutine hello
end module objmod