-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow CamelCase names for CMAKE_BUILD_TYPE ‘Debug’, ‘Release’ and empty '' #131
Comments
The behavior of TriBITS will need to be fixed before I can push this documentation.
For an example of what needs fixed, if you configure a TriBITS project (e.g. Trilinos) with:
it does not set up for debug-mode checking by default:
But when you use upper-case
Also, if the user explicitly sets
It could be hard to fix this without breaking backward compatibility. |
This issue was raised again in #325 (@gsjaardema). I fear that we are going to have to update TriBITS to recognize upper case or camel case for the @gsjaardema, how urgent would you say this is? |
I think it is fairly urgent. I had a couple people mention it to me and when I dug deeper I realized that many of my debug builds are not really being built as debug. At a minimum, the suggested valid build type help string should say these must be all uppercase and give the examples as uppercase (Maybe that is provided by CMAke and unchangeable, in that case, add a comment that says that DEBUG must be DEBUG and not Debug...) |
@gsjaardema, the upper case versions for this are documented here: and throughout that document. (And there is a version of this document build for Trilinos at https://docs.trilinos.org/files/TrilinosBuildReference.html.) But the upper case versions are no-standard CMake so this should be fixed to allow the Camel Case versions of 'Debug', 'Release', etc. The question is, how? Almost anything we do here is going to break backward compatibility so the question is, what is the best solution for users? I can think of a few different options: option-1: Allow both Camel Case and Upper Case versions (e.g. option-2: Change TriBITS to only allow the Camel Case version (i.e. What do you think, option-1 or option-2? |
For someone who uses CMake, they are not going to read external documentation. They will go into the CMakeCache.txt file and change the CMAKE_BUILD_TYPE to "Debug" or "DEBUG". The comment in that file says the "Debug" is a valid entry so they will use that and not realize that they aren't getting debug code. I like option-1. I think the backward compatabilty break in this case is potentially good in that it would be catching potential issues in the application that had been missed previously. |
@gsjaardema, okay, I will work on option-1. Hopefully have something later this week. |
We discussed this at the Trilinos Developers meeting just now. The consensus was to:
It occurred to me that it would be useful to add a more reasoned approach for handling deprecation and breaks in backward compatibility. I could add a TriBITS option |
Raw CMake accepts CamelCase names for 'Debug', 'Release', 'RelWithDebInfo' and 'MinSizeRel' as well as empty '' for
CMAKE_BUILD_TYPE
as described here:https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_TYPE.html
However, raw CMake applies the build options specified by
CMAKE_<LANG>_FLAGS_[DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL]
. That seems inconsistent. Therefore, TriBITS many years ago adopted the convention to use upper case names forCMAKE_BUILD_TYPE
of 'DEBUG', 'RELEASE', etc. and it defined the value 'NONE'. If the user passes in empty '', then the default of 'RELEASE' is selected.While that seemed logical at the time, this is not consistent with raw CMake. A user who knows raw CMake will naturally try to configure at TriBITS-based project with
-DCMAKE_BUILD_TYPE=Release
or-DCMAKE_BUILD_TYPE=Debug
or even-DCMAKE_BUILD_TYPE=
(empty). Even though TriBITS does technically accept any case 'CMAKE_BUILD_TYPE' (it upper-cases it), this does not have the same behavior as with raw CMake.Therefore, this story is to update TriBITS so that it behaves exactly like CMake w.r.t. standard values for
CMAKE_BUILD_TYPE
. The only exception is that if the user does not set 'CMAKE_BUILD_TYPE', then the project can change the default to whatever it wants.The challenge will be fixing this behavior but not breaking backward compatibility or if backward compatibility will be broken, do so in a way that causes least harm and/or risk.
Tasks:
CMAKE_BUILD_TYPE
.CMAKE_BUILD_TYPE
and if the upper case versions will be allowed or not (see options below).The text was updated successfully, but these errors were encountered: