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 16
    • Merge requests 16
  • 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
  • Issues
  • #19401
Closed
Open
Issue created Jun 18, 2019 by Ben Kietzman@ben.kietzman

CMAKE_BUILD_TYPE initialized on Windows before CMAKE_USER_MAKE_RULES_OVERRIDE

On Linux, unless I set -DCMAKE_BUILD_TYPE=$type that variable is an empty string:

$ cat ../CMakeLists.txt
message("CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}'")

$ cmake -G Ninja . | grep CMAKE_BUILD_TYPE=
CMAKE_BUILD_TYPE=''

On Windows, it is Debug unless I override it explicitly:

λ cat ..\CMakeLists.txt
message("CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}'")

λ cmake -G Ninja . | grep CMAKE_BUILD_TYPE=
CMAKE_BUILD_TYPE='Debug'

This is a problem for us because we'd like the default to a release build, but on Windows with the Ninja generator we can't detect whether a build type has been specified explicitly or not (in every other case we can check whether CMAKE_BUILD_TYPE is empty). We see that checking CMAKE_BUILD_TYPE is not a viable approach for IDE generators, but it seems Ninja should be supported. How should we be doing this?

Edited Jun 27, 2019 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking