Skip to content

GitLab

  • Menu
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 3,807
    • Issues 3,807
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & 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
  • CMake
  • CMakeCMake
  • Issues
  • #16975

Closed
Open
Created Jun 14, 2017 by Craig Scott@craig.scottMaintainer

Check<Lang>SourceCompiles modules silently add a compiler definition

The CheckCSourceCompiles, CheckCXXSourceCompiles and CheckFortranSourceCompiles modules silently add a compiler definition for the name of the output variable. For example, the following results in -DMY_OUT_VAR being added to the compiler command line:

cmake_minimum_required(VERSION 3.8)
project(Example)

include(CheckCSourceCompiles)
check_c_source_compiles("int main() { return 0; }" MY_OUT_VAR)

It could be a reasonable thing to do, in which case it should be documented in case the variable name chosen could influence the test. Otherwise, unilaterally adding this compiler definition seems unnecessary since projects have the ability to add such a definition for themselves if they want it. Currently, the documentation makes no mention of this behaviour, so I recommend it either be documented (easier) or the extra compiler definition removed (could change the behaviour for existing projects).

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