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