9542e78525
To implement this, create a new Qt5BuildInternals package. All child Qt modules like qtsvg should use find_package(Qt5BuildInternals) or find_package(Qt5 COMPONENTS BuildInternals) in the their top level CMakeLists.txt. This will make the qt_build_repo() macros available. For qtbase we slightly cheat, and specify a CMAKE_PREFIX_PATH pointing to the source folder that contains the BuildInternals package. For the other modules we actually use a configured and installed package Config file. This change moves variables that used to be written into the QtCore Config file into the BuildInternals package. This way things that are relevant only for building additional Qt modules does not pollute the QtCore package. Task-number: QTBUG-75580 Change-Id: I5479adff2f7903c9c2862d28c05c7f485ce3e4eb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
143 lines
5.9 KiB
CMake
143 lines
5.9 KiB
CMake
## QtPlatform Target:
|
|
add_library(Platform INTERFACE)
|
|
add_library(Qt::Platform ALIAS Platform)
|
|
target_include_directories(Platform
|
|
INTERFACE
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${QT_PLATFORM_DEFINITION_DIR}>
|
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
|
|
$<INSTALL_INTERFACE:${INSTALL_DATADIR}/${QT_PLATFORM_DEFINITION_DIR}>
|
|
$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>
|
|
)
|
|
target_compile_definitions(Platform INTERFACE ${QT_PLATFORM_DEFINITIONS})
|
|
|
|
set(__GlobalConfig_path_suffix "${INSTALL_CMAKE_NAMESPACE}")
|
|
qt_path_join(__GlobalConfig_build_dir ${QT_CONFIG_BUILD_DIR} ${__GlobalConfig_path_suffix})
|
|
qt_path_join(__GlobalConfig_install_dir ${QT_CONFIG_INSTALL_DIR} ${__GlobalConfig_path_suffix})
|
|
|
|
# Generate and install Qt5 config file.
|
|
configure_package_config_file(
|
|
"${PROJECT_SOURCE_DIR}/cmake/QtConfig.cmake.in"
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}Config.cmake"
|
|
INSTALL_DESTINATION "${__GlobalConfig_install_dir}"
|
|
)
|
|
|
|
write_basic_package_version_file(
|
|
${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ConfigVersion.cmake
|
|
VERSION ${PROJECT_VERSION}
|
|
COMPATIBILITY AnyNewerVersion
|
|
)
|
|
|
|
# Generate and install Qt5Tools config file.
|
|
configure_package_config_file(
|
|
"${PROJECT_SOURCE_DIR}/cmake/QtToolsConfig.cmake.in"
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ToolsConfig.cmake"
|
|
INSTALL_DESTINATION "${__GlobalConfig_install_dir}"
|
|
)
|
|
write_basic_package_version_file(
|
|
${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ToolsConfigVersion.cmake
|
|
VERSION ${PROJECT_VERSION}
|
|
COMPATIBILITY AnyNewerVersion
|
|
)
|
|
|
|
qt_install(FILES
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}Config.cmake"
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ConfigVersion.cmake"
|
|
DESTINATION "${__GlobalConfig_install_dir}"
|
|
COMPONENT Devel
|
|
)
|
|
|
|
qt_install(FILES
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ToolsConfig.cmake"
|
|
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ToolsConfigVersion.cmake"
|
|
DESTINATION "${__GlobalConfig_install_dir}Tools"
|
|
COMPONENT Devel
|
|
)
|
|
|
|
## Library to hold global features:
|
|
## These features are stored and accessed via Qt::GlobalConfig, but the
|
|
## files always lived in Qt::Core, so we keep it that way
|
|
add_library(GlobalConfig INTERFACE)
|
|
target_include_directories(GlobalConfig INTERFACE
|
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
|
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/QtCore>
|
|
$<INSTALL_INTERFACE:include>
|
|
$<INSTALL_INTERFACE:include/QtCore>
|
|
)
|
|
qt_feature_module_begin(LIBRARY Core
|
|
PUBLIC_FILE src/corelib/global/qconfig.h
|
|
PRIVATE_FILE src/corelib/global/qconfig_p.h
|
|
)
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
|
|
qt_feature_module_end(GlobalConfig OUT_VAR_PREFIX "__GlobalConfig_")
|
|
|
|
add_library(Qt::GlobalConfig ALIAS GlobalConfig)
|
|
|
|
add_library(GlobalConfigPrivate INTERFACE)
|
|
target_link_libraries(GlobalConfigPrivate INTERFACE GlobalConfig)
|
|
target_include_directories(GlobalConfigPrivate INTERFACE
|
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/QtCore/${PROJECT_VERSION}>
|
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/QtCore/${PROJECT_VERSION}/QtCore>
|
|
$<INSTALL_INTERFACE:include/QtCore/${PROJECT_VERSION}>
|
|
$<INSTALL_INTERFACE:include/QtCore/${PROJECT_VERSION}/QtCore>
|
|
)
|
|
add_library(Qt::GlobalConfigPrivate ALIAS GlobalConfigPrivate)
|
|
|
|
set(__export_targets Platform GlobalConfig GlobalConfigPrivate)
|
|
set(__export_name "${INSTALL_CMAKE_NAMESPACE}Targets")
|
|
qt_install(TARGETS ${__export_targets} EXPORT "${__export_name}")
|
|
qt_install(EXPORT ${__export_name}
|
|
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
|
|
DESTINATION "${__GlobalConfig_install_dir}")
|
|
|
|
qt_internal_export_modern_cmake_config_targets_file(TARGETS ${__export_targets}
|
|
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}
|
|
CONFIG_INSTALL_DIR
|
|
${__GlobalConfig_install_dir})
|
|
|
|
## Install some QtBase specific CMake files:
|
|
qt_copy_or_install(FILES
|
|
cmake/QtBuild.cmake
|
|
cmake/QtCompilerFlags.cmake
|
|
cmake/QtCompilerOptimization.cmake
|
|
cmake/QtFeature.cmake
|
|
cmake/QtPlatformSupport.cmake
|
|
cmake/QtPostProcess.cmake
|
|
cmake/QtSetup.cmake
|
|
cmake/QtModuleConfig.cmake.in
|
|
cmake/QtModuleDependencies.cmake.in
|
|
cmake/QtModuleToolsDependencies.cmake.in
|
|
cmake/QtModuleToolsConfig.cmake.in
|
|
DESTINATION "${__GlobalConfig_install_dir}"
|
|
)
|
|
|
|
|
|
# TODO: Check whether this is the right place to install these
|
|
qt_copy_or_install(DIRECTORY cmake/3rdparty DESTINATION "${__GlobalConfig_install_dir}")
|
|
|
|
# Install our custom Find modules, which will be used by the find_dependency() calls
|
|
# inside the generated ModuleDependencies cmake files.
|
|
qt_copy_or_install(DIRECTORY cmake/
|
|
DESTINATION "${__GlobalConfig_install_dir}"
|
|
FILES_MATCHING PATTERN "Find*.cmake"
|
|
PATTERN "tests" EXCLUDE
|
|
PATTERN "3rdparty" EXCLUDE
|
|
)
|
|
|
|
# Configure and install the QtBuildInternals package.
|
|
set(__build_internals_path_suffix "${INSTALL_CMAKE_NAMESPACE}BuildInternals")
|
|
qt_path_join(__build_internals_build_dir ${QT_CONFIG_BUILD_DIR} ${__build_internals_path_suffix})
|
|
qt_path_join(__build_internals_install_dir ${QT_CONFIG_INSTALL_DIR}
|
|
${__build_internals_path_suffix})
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake"
|
|
"${__build_internals_build_dir}/${INSTALL_CMAKE_NAMESPACE}BuildInternalsConfig.cmake"
|
|
@ONLY
|
|
)
|
|
|
|
qt_install(FILES
|
|
"${__build_internals_build_dir}/${INSTALL_CMAKE_NAMESPACE}BuildInternalsConfig.cmake"
|
|
"${__build_internals_build_dir}/QtBuildInternalsExtra.cmake"
|
|
DESTINATION "${__build_internals_install_dir}"
|
|
COMPONENT Devel
|
|
)
|