[PATCH] cmake: Error on invalid CMAKE_BUILD_TYPE

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 8 14:05:42 PDT 2015


Saleem Abdulrasool <compnerd at compnerd.org> writes:
> On Sat, Aug 8, 2015 at 12:10 AM, Justin Bogner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>     Apparently if you make a typo in the argument to CMAKE_BUILD_TYPE, cmake
>     silently accepts this but doesn't apply any particular build type to
>     your build. For LLVM, this means you get a build that doesn't really
>     make any sense - it's sort of a debug build with asserts disabled.
>    
>     I'm not really sure why cmake allows this at all and the attached patch
>     is basically a horrible hack to avoid the issue, but I just spent an
>     obscene amount of time debugging some bizarre behaviour I ran into
>     because I set the build type to RelWithDebugInfo instead of
>     RelWithDebInfo.
>    
>     Better suggestions welcome.
>
> Personally, I think that "Invalid value for CMAKE_BUILD_TYPE: $
> {CMAKE_BUILD_TYPE}" would be a better message.
>
> I recently ran into this myself (and luckily saw the warning from cmake saying
> it was invalid and was going to default to something else), so I like this
> idea very much.

I think you're thinking of the warning for not specifying a build type
at all, which was added in r230041 and says "No build type selected,
default to Debug". There's no warning at all today if you say
-DCMAKE_BUILD_TYPE=DeTypoBug.

Anyway, I've committed with better wording in r244406.

> LGTM (Ill let you decide on the wordsmithing).
>  
>
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at lists.llvm.org
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org


More information about the llvm-commits mailing list