cmake: don't add install-time include directories when there are none

Change-Id: I380218191139fe514ddac598992b1ba27ac33a41
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Jean-Michaël Celerier 2019-06-05 10:51:45 +02:00 committed by Jean-Michaël Celerier
parent 2401435d89
commit 2eeba9f55f

View File

@ -1083,13 +1083,19 @@ function(add_qt_module target)
qt_autogen_tools_initial_setup(${target}) qt_autogen_tools_initial_setup(${target})
set(_public_includes
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${module_include_dir}>
)
if(NOT arg_NO_MODULE_HEADERS)
list(APPEND _public_includes $<INSTALL_INTERFACE:include/${module}>)
endif()
list(APPEND _public_includes ${arg_PUBLIC_INCLUDE_DIRECTORIES})
extend_target("${target}" extend_target("${target}"
SOURCES ${arg_SOURCES} SOURCES ${arg_SOURCES}
PUBLIC_INCLUDE_DIRECTORIES PUBLIC_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> ${_public_includes}
$<BUILD_INTERFACE:${module_include_dir}>
$<INSTALL_INTERFACE:include/${module}>
${arg_PUBLIC_INCLUDE_DIRECTORIES}
INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
@ -1259,10 +1265,15 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}> $<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}>
$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}/${module}> $<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}/${module}>
$<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}>
$<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}/${module}>
) )
if(NOT arg_NO_MODULE_HEADERS)
target_include_directories("${target_private}" INTERFACE
$<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}>
$<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}/${module}>
)
endif()
if(NOT ${arg_DISABLE_TOOLS_EXPORT}) if(NOT ${arg_DISABLE_TOOLS_EXPORT})
qt_export_tools(${target}) qt_export_tools(${target})
endif() endif()