From a90adae275cef10dd75b8fc19bc97a7cb59c43dc Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Mon, 27 May 2019 11:42:06 +0200 Subject: CMake: Change the default behavior CMAKE_BUILD_TYPE Instead of setting CMAKE_BUILD_TYPE as a regular variable, set it as a cache value, but only as a default. If the user specifies -DCMAKE_BUILD_TYPE=Foo on the command line, that will take priority. PySide2 will inherit the build type from the shiboken build, also unless explicitly specified on the command line. Fix missing quotes around the build type in shiboken_helpers.cmake. Task-number: PYSIDE-980 Change-Id: I2f7e5f71b66467ca5b30056c42d26d9a54ff265b Reviewed-by: Qt CI Bot Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/CMakeLists.txt | 13 ++++++------- sources/shiboken2/data/shiboken_helpers.cmake | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt index 950aa6215..be1b4cd7f 100644 --- a/sources/shiboken2/CMakeLists.txt +++ b/sources/shiboken2/CMakeLists.txt @@ -1,10 +1,13 @@ Include(icecc.cmake) -project(shiboken2) -include(CheckIncludeFileCXX) cmake_minimum_required(VERSION 3.1) cmake_policy(VERSION 3.1) +set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type") + +project(shiboken2) +include(CheckIncludeFileCXX) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_helpers/") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data/") @@ -404,11 +407,7 @@ execute_process( OUTPUT_VARIABLE PYTHON_WITH_COUNT_ALLOCS OUTPUT_STRIP_TRAILING_WHITESPACE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -set(SHIBOKEN_BUILD_TYPE "Release") +set(SHIBOKEN_BUILD_TYPE "${CMAKE_BUILD_TYPE}") if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(SHIBOKEN_BUILD_TYPE "Debug") diff --git a/sources/shiboken2/data/shiboken_helpers.cmake b/sources/shiboken2/data/shiboken_helpers.cmake index c55ee89fe..f4dd4d5dc 100644 --- a/sources/shiboken2/data/shiboken_helpers.cmake +++ b/sources/shiboken2/data/shiboken_helpers.cmake @@ -157,7 +157,7 @@ macro(shiboken_compute_python_libraries) # If the resulting variable # contains a "debug;X;optimized;Y" list like described in shiboken_check_if_limited_api, # make sure to pick just one, so that the final generator expressions are valid. - shiboken_get_library_for_current_config("${SHIBOKEN_PYTHON_LIBRARIES}" ${CMAKE_BUILD_TYPE} "SHIBOKEN_PYTHON_LIBRARIES") + shiboken_get_library_for_current_config("${SHIBOKEN_PYTHON_LIBRARIES}" "${CMAKE_BUILD_TYPE}" "SHIBOKEN_PYTHON_LIBRARIES") if(APPLE) set(SHIBOKEN_PYTHON_LIBRARIES "-undefined dynamic_lookup") -- cgit v1.2.3