From 4a390696d5d0ff1c098c0d5f3955821c453b8027 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Fri, 16 Jul 2021 09:42:43 -0400 Subject: [PATCH] CMakeLists.txt - Set default CMAKE_BUILD_TYPE to Release for non-dev In non-developer situations default CMAKE_BUILD_TYPE=Release --- CMakeLists.txt | 14 +++++++++++++- Changelog | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6d93d07..c9c3bc23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,18 @@ set(CMAKE_AUTORCC ON) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# Set a default build type if none was specified +set(default_build_type "Release") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git" OR ${PROJECT_NAME}_DEVELOPER_MODE) + set(default_build_type "Debug") +endif() +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to ${default_build_type} as none was specified.") + set(CMAKE_BUILD_TYPE "${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() + # setup default install locations include(InstallLocation) include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables @@ -237,7 +249,7 @@ if(${PROJECT_NAME}_PYTHON_BINDINGS) if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC) message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.") endif() - add_subdirectory(python) + add_subdirectory(python) endif() # Generate .pri file for qmake users diff --git a/Changelog b/Changelog index 1abd9096..dbe9e1bc 100644 --- a/Changelog +++ b/Changelog @@ -24,6 +24,7 @@ - Fixes persistent central frame being invisible after closing all tabs (#220) - Added python bindings for the InitialOption struct (#198) - Generate and install camelcase forwarding headers (public, exported classes) + - Build in Release mode by default (in non-developer situations) * v1.3.1 (7 June 2021) - Improve restoring layout when RestoreOption_RelativeToMainWindow is used (#171)