build: fix default debug build for vscode

Check if CMAKE_BUILD_TYPE is false and not just empty string, as it is
some kind of other empty value in the default vscode build and the check
fails.

If CMAKE_BUILD_TYPE is unset, default to Debug, which is what vscode and
most things expect as the default CMAKE_BUILD_TYPE.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2023-02-21 20:53:20 +00:00
parent f1d3f631d2
commit 83d24828df
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 2 additions and 2 deletions

View File

@ -82,8 +82,8 @@ if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
elseif(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$")
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}', must be one of: 'Release', 'Debug', 'RelWithDebInfo' or 'MinSizeRel'")
endif()