Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 4.4k
    • Issues 4.4k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #16234

CMake supporting for Fortran 2008 submodules

The transcript below and the attached file fortran-submodule-support.tar.gz demonstrate a skeleton Fortran 2008 submodule implementation that is currently supported by the GNU, Cray, IBM, and Intel compilers. As discussed on the CMake users list in March 2016, the CMake parser apparently cannot handle this syntax.

$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.6)
project (fortran-submodule-issue Fortran)
add_executable(submodule-issue-reproducer fortran-submodule.F90)
rouson@localhost:~/Code/AdHoc/src/cmake/bug-xxxxy$ cat fortran-submodule.f90 
module foo_interface
  implicit none
  interface 
    module subroutine foo() 
    end subroutine 
  end interface 
end module 

submodule (foo_interface) foo_implementation
  implicit none
contains
  module subroutine foo() 
  end subroutine 
end submodule 
 
end  ! Dummy main program to produce an executable file

$ mkdir build

$ cd build

$ FC=gfortran cmake ..
-- The Fortran compiler identification is GNU 6.1.0
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Check for working Fortran compiler: /opt/local/bin/gfortran
-- Check for working Fortran compiler: /opt/local/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /opt/local/bin/gfortran supports Fortran 90
-- Checking whether /opt/local/bin/gfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rouson/Code/AdHoc/src/cmake/bug-xxxxy/build
rouson@localhost:~/Code/AdHoc/src/cmake/bug-xxxxy/build$ make
Scanning dependencies of target submodule-issue-reproducer
[ 50%] Building Fortran object CMakeFiles/submodule-issue-reproducer.dir/fortran-submodule.F90.o
Error copying Fortran module "subroutine".  Tried "SUBROUTINE.mod" and "subroutine.mod".
make[2]: *** [CMakeFiles/submodule-issue-reproducer.dir/fortran-submodule.F90.o.provides.build] Error 1
make[1]: *** [CMakeFiles/submodule-issue-reproducer.dir/all] Error 2
make: *** [all] Error 2

$ gfortran --version
GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0

$ cmake --version
cmake version 3.6.1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking