From 94bc24496519b223eff09f52e906f3573883ddbb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Jan 2024 21:45:34 +0100 Subject: [PATCH] CMake: also help find where the AppStream headers are --- CMakeModules/AppStreamHelper.cmake | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeModules/AppStreamHelper.cmake b/CMakeModules/AppStreamHelper.cmake index 6b1ef1284..e23f2e4d4 100644 --- a/CMakeModules/AppStreamHelper.cmake +++ b/CMakeModules/AppStreamHelper.cmake @@ -46,7 +46,19 @@ else() endif() endif() -if(NOT _appstream_name) +if(HAVE_APPSTREAM) + # Look for the directory name containing the headers + find_file(_appstream_header NAMES ${_appstream_name}/pool.h AppStreamQt/pool.h) + if(NOT _appstream_header) + set(HAVE_APPSTREAM OFF) + else() + if(_appstream_header MATCHES /${_appstream_name}/) + set(_appstream_header_directory ${_appstream_name}) + else() + set(_appstream_header_directory AppStreamQt) + endif() + endif() +else() # Placeholder name set(_appstream_name AppStreamQt) endif() @@ -67,7 +79,7 @@ set_package_properties( add_library(calaappstream INTERFACE) # Always, but might not be populated if(HAVE_APPSTREAM) - target_compile_definitions(calaappstream INTERFACE HAVE_APPSTREAM_VERSION=${${_appstream_name}_VERSION_MAJOR}) + target_compile_definitions(calaappstream INTERFACE HAVE_APPSTREAM_VERSION=${${_appstream_name}_VERSION_MAJOR} HAVE_APPSTREAM_HEADERS=${_appstream_header_directory}) target_link_libraries(calaappstream INTERFACE ${_appstream_name}) add_library(calamares::appstreamqt ALIAS calaappstream) endif()