From f7dcb71b03fd1986cfa5da91f234bc9d20f4cfe5 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Tue, 3 May 2022 16:38:08 +0300 Subject: [PATCH] [build] Set default build type to `RelWithDebInfo` --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 647902af..a30a034d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,19 @@ option(BUILD_SHARED_LIBS "Build using shared uvg266 library" ON) option(BUILD_TESTS "Build tests" ON) +# https://www.kitware.com/cmake-and-the-default-build-type/ +# Set a default build type if none was specified +set(UVG_DEFAULT_BUILD_TYPE "RelWithDebInfo") + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "No build type specified, setting to '${UVG_DEFAULT_BUILD_TYPE}'.") + set(CMAKE_BUILD_TYPE "${UVG_DEFAULT_BUILD_TYPE}" CACHE + STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + find_package(Git QUIET) if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")