qt5base-lts/cmake/QtBaseGlobalTargets.cmake
Tobias Hunger 3a8d8344e5 CMake: Merge qt_internal_module_include_dir and qt_internal_module_info
... and fix the fallout of this change. It results in more targets being
passed overall (instead of a strange mix of targets and module names),
so this is a good thing(TM).

Change-Id: I1c4326b80e2c6675356587879ec8471ef7249a50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:11 +00:00

59 lines
2.0 KiB
CMake

# Where QtBuild.cmake can find QtModuleConfig.cmake.in
set(Qt${PROJECT_VERSION_MAJOR}_DIR "${PROJECT_SOURCE_DIR}/cmake")
## QtPlatform Target:
set(name "Qt")
add_library("${name}" INTERFACE)
add_library("Qt::Platform" ALIAS "${name}")
target_include_directories("${name}"
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("${name}" INTERFACE ${QT_PLATFORM_DEFINITIONS})
set(config_install_dir "${INSTALL_LIBDIR}/cmake/${name}${PROJECT_VERSION_MAJOR}")
install(TARGETS "${name}" EXPORT "${name}${PROJECT_VERSION_MAJOR}Targets")
install(EXPORT "${name}${PROJECT_VERSION_MAJOR}Targets" NAMESPACE Qt:: DESTINATION "${config_install_dir}")
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/QtConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}Config.cmake"
INSTALL_DESTINATION "${config_install_dir}"
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}ConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}ConfigVersion.cmake"
DESTINATION "${config_install_dir}"
COMPONENT Devel
)
## Library to hold global features:
add_library(Qt_global_Config INTERFACE)
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(Qt_global_Config)
## Install some QtBase specific CMake files:
install(FILES
cmake/QtBuild.cmake
cmake/QtFeature.cmake
cmake/QtPostProcess.cmake
cmake/QtSetup.cmake
cmake/QtModuleConfig.cmake.in
DESTINATION "${config_install_dir}"
)