Allow prefix builds with developer-build as feature enabled

Just like with qmake, separate the two "features".

Change-Id: Idf2a796c7c4aaa740c471688b2221d7041fed643
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-06-25 12:09:10 +02:00
parent 6290efc4eb
commit e5b62e9607
2 changed files with 15 additions and 10 deletions

View File

@ -289,7 +289,7 @@ function(remove_install_target)
add_custom_target(remove_cmake_install ALL DEPENDS ${file_generated})
endfunction()
function(qt_set_up_developer_build)
function(qt_set_up_nonprefix_build)
if(NOT QT_WILL_INSTALL)
remove_install_target()
endif()

View File

@ -40,14 +40,10 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
# Detect non-prefix builds, either when the install prefix is set to the binary dir
# or when enabling developer builds and no prefix is specified.
if((CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) OR (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build))
set(QT_WILL_INSTALL OFF)
set(QT_BUILD_TESTING ON)
# Handle non-prefix builds by setting the cmake install prefix to the project binary dir.
if(PROJECT_NAME STREQUAL "QtBase")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH
@ -61,6 +57,15 @@ else()
set(QT_BUILD_TESTING OFF)
endif()
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
set(QT_BUILD_TESTING ON)
endif()
## Set up testing
option(BUILD_TESTING "Build the testing tree." ${QT_BUILD_TESTING})
include(CTest)
@ -86,8 +91,8 @@ include(QtCompilerOptimization)
## Compiler flags:
include(QtCompilerFlags)
## Set up developer build:
qt_set_up_developer_build()
## Set up non-prefix build:
qt_set_up_nonprefix_build()
## Find host tools (if non native):
set(QT_HOST_PATH "" CACHE PATH "Installed Qt host directory path, used for cross compiling.")