[llvm] r244406 - cmake: Error on invalid CMAKE_BUILD_TYPE

Kuperstein, Michael M via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 00:43:00 PDT 2015


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] On Behalf Of Justin Bogner via llvm-commits
Sent: Sunday, August 09, 2015 00:05
To: 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
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
---------------------------------------------------------------------
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.


More information about the llvm-commits mailing list