Skip to content

Commit

Permalink
MDEV-25232 Ninja MSVC build sets default CMAKE_BUILD_TYPE to Debug
Browse files Browse the repository at this point in the history
This is incosistent with other single config generators, where
the default type has always been RelWithDebInfo.

Fixed by moving setting of CMAKE_BUILD_TYPE right before PROJECT.
  • Loading branch information
vaintroub committed May 9, 2021
1 parent e1bf1ae commit d0785f7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Setting build type to RelWithDebInfo as none was specified.
# Must occur before PROJECT
SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel"
FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()

PROJECT(MySQL)

# explicitly set the policy to OLD
Expand Down Expand Up @@ -54,17 +66,6 @@ IF(NOT DEFINED MANUFACTURER)
MARK_AS_ADVANCED(MANUFACTURER)
ENDIF()

IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Setting build type to RelWithDebInfo as none was specified.")
SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel"
FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()


# MAX_INDEXES - Set the maximum number of indexes per table, default 64
IF (NOT MAX_INDEXES)
SET(MAX_INDEXES 64)
Expand Down

0 comments on commit d0785f7

Please sign in to comment.