Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,105
    • Issues 4,105
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • 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
  • Merge requests
  • !4659

Fortran: Add Fortran_PREPROCESS property

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Peter Hill requested to merge ZedThree/cmake:feature/fortran-preprocess into master Apr 24, 2020
  • Overview 64
  • Commits 4
  • Pipelines 16
  • Changes 38

Add a Fortran_PREPROCESS target/source file property as described in #18870 (closed) to control whether or not Fortran files should always/never be preprocessed.

As this is my first dive into the CMake source, I essentially just copy-pasted the code to handle Fortran_FORMAT.

EDIT: Design questions posted in original description have been moved to #18870 (comment 742515).

Original Description Design Questions

Some issues:

  1. Some compilers (NAG, PGI and SunPro) don't have an option to never preprocess files. Two problems with this:
    • If the target property is set to ALWAYS and then a particular source file is set to NEVER, what should be done? Does CMake just ignore the target property in favour of the source file property? In which case, I guess this isn't a problem.
    • If the source file extension is uppercase, most compilers will preprocess it, and for these compilers not doing that won't be possible. One possible fix would be to make a copy of the file with a lowercase extension and compile that.
  2. No compilers except HP have an explicit option to use the default preprocessing behaviour. That is, aside from HP, it is not possible to select a native BY_EXTENSION flag. This could be handled internally by CMake, by checking the file extension and assuming that uppercase means ALWAYS and lowercase means NEVER, but this could cause issues on case insensitive filesystems.
  3. I've not touched the files cmGlobalXCodeGenerator.cxx or cmLocalVisualStudio7Generator.cxx as I wasn't sure exactly what compiler these are supposed to target.
  4. Default behaviour from CMake is unchanged. It was suggested by @ben.boeckel in #18870 (closed) that the default should be ALWAYS. Where best to set this? My first thought would be in cmOutputConverter::GetFortranPreprocess to return FortranPreprocessAlways by default

Fixes: #18870 (closed)
Topic-rename: fortran-preprocess-property

Edited Apr 24, 2020 by Brad King
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: feature/fortran-preprocess