From 6c07e9f3bb27eafe13df50380e221ae178f31a57 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 6 Aug 2020 09:56:58 +0200 Subject: [PATCH] CMake: Fix build with custom INSTALL_INCLUDEDIR The include directory in Qt's build directory is always named "include", no matter what the value of INSTALL_INCLUDEDIR is. The main reason is that the name "include" is hard-coded in syncqt. The INSTALL_INCLUDEDIR variable must only affect the installation location of headers. Fixes: QTBUG-85893 Change-Id: I5367bc589cba129eb41817e2b58d470f730bb5ac Reviewed-by: Alexandru Croitor --- cmake/QtBaseGlobalTargets.cmake | 10 +++++----- cmake/QtBuild.cmake | 15 +++++++-------- cmake/QtPostProcess.cmake | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 1e5de239d6..d845de8892 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -4,7 +4,7 @@ add_library(Qt::Platform ALIAS Platform) target_include_directories(Platform INTERFACE $ - $ + $ $ $ ) @@ -276,8 +276,8 @@ qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/${__qt_cmake_install_scri ## files always lived in Qt::Core, so we keep it that way add_library(GlobalConfig INTERFACE) target_include_directories(GlobalConfig INTERFACE - $ - $ + $ + $ $ $ ) @@ -308,8 +308,8 @@ add_library(Qt::GlobalConfig ALIAS GlobalConfig) add_library(GlobalConfigPrivate INTERFACE) target_link_libraries(GlobalConfigPrivate INTERFACE GlobalConfig) target_include_directories(GlobalConfigPrivate INTERFACE - $ - $ + $ + $ $ $ ) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index d44d3c9028..a20531e3cc 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1843,8 +1843,8 @@ function(qt_internal_module_info result target) string(REPLACE "." "_" define "${define}") set("${result}_upper" "${upper}" PARENT_SCOPE) set("${result}_lower" "${lower}" PARENT_SCOPE) - set("${result}_repo_include_dir" "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}" PARENT_SCOPE) - set("${result}_include_dir" "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}/${module}" PARENT_SCOPE) + set("${result}_repo_include_dir" "${QT_BUILD_DIR}/include" PARENT_SCOPE) + set("${result}_include_dir" "${QT_BUILD_DIR}/include/${module}" PARENT_SCOPE) set("${result}_define" "${define}" PARENT_SCOPE) endfunction() @@ -2184,7 +2184,7 @@ function(qt_install_injections target build_dir install_dir) # ${qtbase_build_dir}. # # In the code below, ${some_prefix} == ${build_dir}. - set(lower_case_forwarding_header_path "${build_dir}/${INSTALL_INCLUDEDIR}/${module}") + set(lower_case_forwarding_header_path "${build_dir}/include/${module}") if(destinationdir) string(APPEND lower_case_forwarding_header_path "/${destinationdir}") endif() @@ -2219,7 +2219,7 @@ function(qt_install_injections target build_dir install_dir) # Generate UpperCaseNamed forwarding headers (part 3). foreach(fwd_hdr ${fwd_hdrs}) - set(upper_case_forwarding_header_path "${INSTALL_INCLUDEDIR}/${module}") + set(upper_case_forwarding_header_path "include/${module}") if(destinationdir) string(APPEND upper_case_forwarding_header_path "/${destinationdir}") endif() @@ -2234,8 +2234,7 @@ function(qt_install_injections target build_dir install_dir) "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}") else() # Install the forwarding header. - qt_path_join(install_destination - ${install_dir} ${upper_case_forwarding_header_path}) + qt_path_join(install_destination "${install_dir}" "${INSTALL_INCLUDEDIR}" ${module}) qt_install(FILES "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}" DESTINATION ${install_destination} OPTIONAL) endif() @@ -2782,7 +2781,7 @@ function(qt_add_module target) set_target_properties("${target}" PROPERTIES INTERFACE_MODULE_HAS_HEADERS ON) ### FIXME: Can we replace headers.pri? - set(module_include_dir "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}/${module_include_name}") + set(module_include_dir "${QT_BUILD_DIR}/include/${module_include_name}") qt_read_headers_pri("${module_include_dir}" "module_headers") set(module_depends_header "${module_include_dir}/${module}Depends") if(is_framework) @@ -4279,7 +4278,7 @@ function(qt_add_test name) set(private_includes "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" - "$" + "$" ${arg_INCLUDE_DIRECTORIES} ) diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index f31e429233..2ad06a5a7b 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -1,5 +1,5 @@ function(qt_internal_write_depends_file module) - set(outfile "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}/${module}/${module}Depends") + set(outfile "${QT_BUILD_DIR}/include/${module}/${module}Depends") set(contents "/* This file was generated by cmake with the info from ${module} target. */\n") string(APPEND contents "#ifdef __cplusplus /* create empty PCH in C mode */\n") foreach (m ${ARGN})