58c1c6ee5c
The find_dependency() macro calls return() on failure, meaning any code after it will be ignored, thus checking any XXX_FOUND variables after find_dependency() is pointless. Fix the places where we use find_dependency() and set the "failed" state before the call and the "success" state afterwards. Change-Id: Ia5239c704f02a9bec972210374ffed7808b14055 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
36 lines
1.2 KiB
CMake
36 lines
1.2 KiB
CMake
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
|
set(_third_party_deps "@third_party_deps@")
|
|
|
|
@third_party_extra@
|
|
|
|
foreach(_target_dep ${_third_party_deps})
|
|
list(GET _target_dep 0 pkg)
|
|
list(GET _target_dep 1 version)
|
|
list(GET _target_dep 2 components)
|
|
set(find_package_args "${pkg}")
|
|
if(version)
|
|
list(APPEND find_package_args "${version}")
|
|
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)
|
|
string(REPLACE " " ";" components "${components}")
|
|
find_dependency(${find_package_args} COMPONENTS ${components})
|
|
else()
|
|
find_dependency(${find_package_args})
|
|
endif()
|
|
endforeach()
|
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
|
|
unset(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE)
|