[llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE

Juergen Ributzka via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 09:17:54 PDT 2015


Hi Justin,

Could you make the check case-insensitive?

—Juergen

> On Aug 8, 2015, at 2:04 PM, Justin Bogner via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: bogner
> Date: Sat Aug  8 16:04:45 2015
> New Revision: 244406
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=244406&view=rev
> Log:
> cmake: Error on invalid CMAKE_BUILD_TYPE
> 
> 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. This means you get a build that doesn't really
> make any sense - it's sort of a debug build with asserts disabled.
> 
> Error out instead.
> 
> Modified:
>    llvm/trunk/CMakeLists.txt
> 
> Modified: llvm/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=244406&r1=244405&r2=244406&view=diff
> ==============================================================================
> --- llvm/trunk/CMakeLists.txt (original)
> +++ llvm/trunk/CMakeLists.txt Sat Aug  8 16:04:45 2015
> @@ -7,6 +7,11 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C
>   set(CMAKE_BUILD_TYPE "Debug")
> endif()
> 
> +if (CMAKE_BUILD_TYPE AND
> +    NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
> +  message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
> +endif()
> +
> if(POLICY CMP0022)
>   cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
> endif()
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list