Revert "Revert "CMake: Fix usage of find_dependency()""
...and fix the build errors the original change caused.
This reverts commit 127fb8bb55
.
Change-Id: I4006b32734a51c5d101dd73c957f81d2a0f84ba1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
721116de30
commit
b9c493728a
@ -51,15 +51,13 @@ endif()
|
|||||||
|
|
||||||
# Find required dependencies, if any.
|
# Find required dependencies, if any.
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
||||||
endif()
|
if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND)
|
||||||
if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND)
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
message(FATAL_ERROR "Failed to find Qt Platform dependency: "
|
||||||
message(FATAL_ERROR
|
"${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}")
|
||||||
"Failed to find Qt Platform dependency:
|
endif()
|
||||||
${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
|
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)
|
||||||
|
|
||||||
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
||||||
set(_third_party_deps "@third_party_deps@")
|
set(_third_party_deps "@third_party_deps@")
|
||||||
|
|
||||||
@ -12,24 +14,24 @@ foreach(_target_dep ${_third_party_deps})
|
|||||||
list(APPEND find_package_args "${version}")
|
list(APPEND find_package_args "${version}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Already build an error message, because find_dependency calls return() on failure.
|
||||||
|
set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
|
||||||
|
if(version)
|
||||||
|
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nVersion: ${version}")
|
||||||
|
endif()
|
||||||
|
if(components)
|
||||||
|
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${components}")
|
||||||
|
endif()
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
|
||||||
|
"${__@INSTALL_CMAKE_NAMESPACE@_message}")
|
||||||
|
|
||||||
if(components)
|
if(components)
|
||||||
string(REPLACE " " ";" components "${components}")
|
string(REPLACE " " ";" components "${components}")
|
||||||
find_dependency(${find_package_args} COMPONENTS ${components})
|
find_dependency(${find_package_args} COMPONENTS ${components})
|
||||||
else()
|
else()
|
||||||
find_dependency(${find_package_args})
|
find_dependency(${find_package_args})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)
|
|
||||||
set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
|
|
||||||
if(version)
|
|
||||||
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nVersion: ${version}")
|
|
||||||
endif()
|
|
||||||
if(components)
|
|
||||||
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${components}")
|
|
||||||
endif()
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
|
|
||||||
"${__@INSTALL_CMAKE_NAMESPACE@_message}")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
|
||||||
|
unset(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE)
|
||||||
|
@ -14,6 +14,12 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependenci
|
|||||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# If *ConfigDependencies.cmake exists, the variable value will be defined there.
|
||||||
|
# Don't override it in that case.
|
||||||
|
if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target@_FOUND")
|
||||||
|
set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT QT_NO_CREATE_TARGETS)
|
if (NOT QT_NO_CREATE_TARGETS)
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
|
||||||
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
|
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
|
||||||
@ -85,7 +91,6 @@ include(${_qt_@PROJECT_VERSION_MAJOR@_config_cmake_dir}/QtFeature.cmake)
|
|||||||
|
|
||||||
qt_make_features_available(@QT_CMAKE_EXPORT_NAMESPACE@::@target@)
|
qt_make_features_available(@QT_CMAKE_EXPORT_NAMESPACE@::@target@)
|
||||||
|
|
||||||
set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE)
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
# Make sure @INSTALL_CMAKE_NAMESPACE@ is found before anything else.
|
# Make sure @INSTALL_CMAKE_NAMESPACE@ is found before anything else.
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
||||||
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
|
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
|
||||||
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
if (NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
||||||
set(_third_party_deps "@third_party_deps@")
|
set(_third_party_deps "@third_party_deps@")
|
||||||
@ -25,11 +22,6 @@ foreach(_target_dep ${_third_party_deps})
|
|||||||
else()
|
else()
|
||||||
find_dependency(${find_package_args})
|
find_dependency(${find_package_args})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Find Qt tool package.
|
# Find Qt tool package.
|
||||||
@ -47,10 +39,15 @@ foreach(_target_dep ${_tool_deps})
|
|||||||
list(GET _target_dep 0 pkg)
|
list(GET _target_dep 0 pkg)
|
||||||
list(GET _target_dep 1 version)
|
list(GET _target_dep 1 version)
|
||||||
|
|
||||||
find_dependency(${pkg} ${version})
|
unset(find_package_args)
|
||||||
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||||
|
list(APPEND find_package_args QUIET)
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||||
|
list(APPEND find_package_args REQUIRED)
|
||||||
|
endif()
|
||||||
|
find_package(${pkg} ${version} ${find_package_args})
|
||||||
if (NOT ${pkg}_FOUND)
|
if (NOT ${pkg}_FOUND)
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
||||||
if(QT_HOST_PATH)
|
if(QT_HOST_PATH)
|
||||||
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
|
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
|
||||||
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
|
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
|
||||||
@ -74,12 +71,7 @@ foreach(_target_dep ${_target_deps})
|
|||||||
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
|
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
|
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
||||||
set(_tool_deps "@package_deps@")
|
set(_tool_deps "@package_deps@")
|
||||||
foreach(_target_dep ${_tool_deps})
|
foreach(_target_dep ${_tool_deps})
|
||||||
list(GET _target_dep 0 pkg)
|
list(GET _target_dep 0 pkg)
|
||||||
@ -7,10 +8,6 @@ foreach(_target_dep ${_tool_deps})
|
|||||||
if (NOT ${pkg}_FOUND)
|
if (NOT ${pkg}_FOUND)
|
||||||
find_dependency(${pkg} ${version})
|
find_dependency(${pkg} ${version})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set(@target@_FOUND FALSE)
|
||||||
|
|
||||||
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
||||||
set(_third_party_deps "@third_party_deps@")
|
set(_third_party_deps "@third_party_deps@")
|
||||||
|
|
||||||
@ -10,16 +12,11 @@ foreach(_target_dep ${_third_party_deps})
|
|||||||
list(APPEND find_package_args "${version}")
|
list(APPEND find_package_args "${version}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(components)
|
if(components)
|
||||||
string(REPLACE " " ";" components "${components}")
|
string(REPLACE " " ";" components "${components}")
|
||||||
find_dependency(${find_package_args} COMPONENTS ${components})
|
find_dependency(${find_package_args} COMPONENTS ${components})
|
||||||
else()
|
else()
|
||||||
find_dependency(${find_package_args})
|
find_dependency(${find_package_args})
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
@ -34,9 +31,6 @@ foreach(_target_dep ${_target_deps})
|
|||||||
PATHS @find_dependency_paths@ ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
PATHS @find_dependency_paths@ ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
|
||||||
set(@target@_FOUND FALSE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
set(@target@_FOUND TRUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user