[llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 14:28:30 PDT 2015


Takumi,

The proper way to detect multi-configuration mode is:

if (NOT CMAKE_CONFIGURATION_TYPES)

In multi-configuration CMAKE_CONFIGURATION_TYPES will list all the configuration types that will be supported (http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html <http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html>).

-Chris

> On Aug 11, 2015, at 1:45 AM, NAKAMURA Takumi via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> I am using it to detect multiconfiguration mode in llvm/utils/llvm-lit/CMakeLists.txt.
> 
> if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
> 
> 
> 
> On Tue, Aug 11, 2015 at 5:42 PM Kuperstein, Michael M <michael.m.kuperstein at intel.com <mailto:michael.m.kuperstein at intel.com>> wrote:
> Yes, because it doesn’t set any CMAKE_BUILD_TYPE by default, which is, IMO, just fine for VS.
> 
> That’s what bit me an hour ago, had to re-configure manually with a random (from my perspective) CMAKE_BUILD_TYPE.
> 
>   <>
> From: NAKAMURA Takumi [mailto:geek4civic at gmail.com <mailto:geek4civic at gmail.com>] 
> Sent: Tuesday, August 11, 2015 11:37
> To: Kuperstein, Michael M; Yaron Keren
> Cc: llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> 
> Subject: Re: [llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE
> 
>  
> 
> FYI, a failing build; http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/475 <http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/475>
>  
> 
> On Tue, Aug 11, 2015 at 5:19 PM Kuperstein, Michael M via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> 
> I agree it’s very slow, but it’s still a valid configuration - especially when debugging tablegen itself. :-)
> 
> Whether LLVM_OPTIMIZED_TABLEGEN should be the default is a separate question.
> 
>   <>
> From: Yaron Keren [mailto:yaron.keren at gmail.com <mailto:yaron.keren at gmail.com>] 
> Sent: Tuesday, August 11, 2015 11:04
> To: Kuperstein, Michael M
> Cc: Justin Bogner; llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> Subject: Re: [llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE
> 
>  
> 
> It errors when the build is not one of the known:Debug|Release|RelWithDebInfo|MinSizeRel.
> 
> An invalid argument is always an error and without this patch the build just goes on.
> 
>  
> 
> For Visual C++ you don't have to specify CMAKE_BUILD_TYPE as CMAKE creates a multi solution but it still significant. Without CMAKE_BUILD_TYPE and without LLVM_OPTIMIZED_TABLEGEN, tablegen will be built in Debug config which is really slow. 
> 
>  
> 
>  
> 
>  
> 
> 2015-08-11 10:43 GMT+03:00 Kuperstein, Michael M via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>>:
> 
> Hi Justin,
> 
> I'm not sure erroring out makes sense when generating for Visual Studio (since the solution is always generated with all build types).
> Perhaps disable it for VS?
> 
> Thanks,
>   Michael
> 
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org <mailto:llvm-commits-bounces at lists.llvm.org>] On Behalf Of Justin Bogner via llvm-commits
> Sent: Sunday, August 09, 2015 00:05
> To: llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> Subject: [llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE
> 
> Author: bogner
> Date: Sat Aug  8 16:04:45 2015
> New Revision: 244406
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=244406&view=rev <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 <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 <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>  
> 
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150812/f080434a/attachment.html>


More information about the llvm-commits mailing list