File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,23 @@ option(USE_TSAN "Enable ThreadSanitizer checks" OFF)
25
25
option (USE_MSAN "Enable MemorySanitizer checks" OFF )
26
26
option (USE_VALGRIND "Enable Valgrind instrumentation" OFF )
27
27
28
+ set (KNOWN_BUILD_TYPES Release Debug RelWithDebInfo MinSizeRel )
29
+ string (REPLACE ";" " " KNOWN_BUILD_TYPES_STR "${KNOWN_BUILD_TYPES} " )
30
+
31
+ if (NOT CMAKE_BUILD_TYPE )
32
+ message (STATUS "No build type selected (CMAKE_BUILD_TYPE), defaulting to Release" )
33
+ set (CMAKE_BUILD_TYPE "Release" )
34
+ else ()
35
+ message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE} " )
36
+ if (NOT CMAKE_BUILD_TYPE IN_LIST KNOWN_BUILD_TYPES )
37
+ message (WARNING "Unusual build type was set (${CMAKE_BUILD_TYPE} ), please make sure it is a correct one. "
38
+ "The following ones are supported by default: ${KNOWN_BUILD_TYPES_STR} ." )
39
+ endif ()
40
+ endif ()
41
+
42
+ set (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE} " CACHE STRING "Choose the type of build, options are: ${KNOWN_BUILD_TYPES_STR} ..." FORCE )
43
+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${KNOWN_BUILD_TYPES} )
44
+
28
45
# For using the options listed in the OPTIONS_REQUIRING_CXX variable
29
46
# a C++17 compiler is required. Moreover, if these options are not set,
30
47
# CMake will set up a strict C build, without C++ support.
You can’t perform that action at this time.
0 commit comments