Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • This works until I make a debug build. After a single debug build, all the subsequent ones are debug builds, even if cmake .. is used
    – marmistrz
    Commented Dec 28, 2016 at 12:06
  • 1
    I don't remember where I've read it, but it's considered bad practice to set CMAKE_BUILD_TYPE from inside a CMakeLists.txt. Prefer to pass it from CMake command line.
    – roalz
    Commented Dec 28, 2016 at 12:08
  • @marmistrz I've added an update on why this happens, and how to "reset" it. I am trying to think of a way to achieve an implicit reset, but it's not easy. Commented Dec 28, 2016 at 12:08
  • @roalz The OP wants rather non-standard usage of CMake in the first place. I will however add a suitable disclaimer. Commented Dec 28, 2016 at 12:09
  • 1
    "recommended usage of CMake is to always specify CMAKE_BUILD_TYPE explicitly on the command line ..." - Not according to this Debian bug report: CMake sets the default optimization level to -O3.
    – jww
    Commented Sep 18, 2017 at 0:42