Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,194
    • Issues 3,194
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 16
    • Merge Requests 16
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • CMake
  • CMakeCMake
  • Merge Requests
  • !4659

Merged
Opened Apr 24, 2020 by Peter Hill@ZedThreeContributor

Fortran: Add Fortran_PREPROCESS property

  • 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
Reviewer
Request review from
3.18.0
Milestone
3.18.0 (Past due)
Assign milestone
Time tracking
Reference: cmake/cmake!4659
Source branch: feature/fortran-preprocess

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.