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
Don't restrict list of CMake build types #60975
Comments
I found the commit with that changes: 55f097f
I think that commit makes sense. |
ping @bogner , what do you think? Should we close this issue or maybe add more |
I disagree, mainly as the list of build types is not fixed. If someone means to type The context here is that I’m defining a new build type as we’re trying to control the build flags, and this fatal error means that fails. |
It’s probably fine to remove this check and let people do custom cmake build types. It’s definitely broken if someone makes a typo here, so I do like the safety net, but that’s not the only instance where cmake’s interface is user-hostile and it isn’t really realistic for us to catch all of the ways this can go wrong. |
Suggestion: |
I'd certainly be happy with a warning that the build type is unknown. I'm defining a new one so I'm happy with that, but should help users who are new to cmake. |
I've created: https://reviews.llvm.org/D144835 |
If you're defining your own build type, you could modify the check to include your new keyword? I appreciate code that keeps me from wasting time with typos. |
Defining a build type is just a matter of naming it, if I pass |
Just adding to this conversation that I just spent a non-insignificant amount of time tracking down an issue that turned out to be related to a typo I made in specifying As @bogner mentions, CMake's design is fairly user-hostile here and doesn't have great support for doing this elegantly, but the current fix seems to optimize for a relatively niche use case at the expense of usability for everyone else. I think there are certainly alternative solutions that allow for this use case while still allowing for the message to set |
This patch makes it so that specifying an invalid value for CMAKE_BUILD_TYPE is a fatal error. Having this simply as a warning has caused me (and probably others) a decent amount of headache. The check was present before, but was proposed to be modified to a warning in llvm#60975 and changed to a warning in c75dbed. This patch reenables that behavior to hopefully reduce frustration for people building LLVM in the common case while still allowing for alternative build types to be setup without needing to perform source modification through the addition of a CMake flag.
This patch makes it so that specifying an invalid value for CMAKE_BUILD_TYPE is a fatal error. Having this simply as a warning has caused me (and probably others) a decent amount of headache. The check was present before, but was proposed to be modified to a warning in #60975 and changed to a warning in c75dbed. This patch reenables that behavior to hopefully reduce frustration for people building LLVM in the common case while still allowing for alternative build types to be setup without needing to perform source modification through the addition of a CMake flag.
This patch makes it so that specifying an invalid value for CMAKE_BUILD_TYPE is a fatal error. Having this simply as a warning has caused me (and probably others) a decent amount of headache. The check was present before, but was proposed to be modified to a warning in llvm#60975 and changed to a warning in c75dbed. This patch reenables that behavior to hopefully reduce frustration for people building LLVM in the common case while still allowing for alternative build types to be setup without needing to perform source modification through the addition of a CMake flag.
This patch makes it so that specifying an invalid value for CMAKE_BUILD_TYPE is a fatal error. Having this simply as a warning has caused me (and probably others) a decent amount of headache. The check was present before, but was proposed to be modified to a warning in llvm#60975 and changed to a warning in c75dbed. This patch reenables that behavior to hopefully reduce frustration for people building LLVM in the common case while still allowing for alternative build types to be setup without needing to perform source modification through the addition of a CMake flag.
For example, the llvm directory restricts the value of
CMAKE_BUILD_TYPE
:https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt#L389
That is the default set of build types, but it is not the exhaustive list of build types. Quoting from the CMake manual:
I suggest just deleting this chunk, as it doesn't serve any purpose: the person building llvm should be able to specify a custom build type if they wish.
The text was updated successfully, but these errors were encountered: