CMake: simplify the KPMcore helper

This commit is contained in:
Adriaan de Groot 2022-07-21 13:19:19 +02:00
parent 09ed07b0c8
commit f42f2514cb

View File

@ -10,9 +10,7 @@
# If KPMcore is not found, still create calamares::kpmcore interface
# library, which will add definition WITHOUT_KPMcore.
#
if(NOT KPMcore_searched_for AND NOT TARGET calapmcore)
set(KPMcore_searched_for TRUE)
if(NOT TARGET calapmcore)
find_package(KPMcore 20.04.0)
set_package_properties(
KPMcore
@ -34,15 +32,12 @@ if(NOT KPMcore_searched_for AND NOT TARGET calapmcore)
target_link_libraries(calapmcore INTERFACE kpmcore Qt5::DBus KF5::I18n KF5::WidgetsAddons)
target_include_directories(calapmcore INTERFACE ${KPMCORE_INCLUDE_DIR})
set(KPMcore_API_DEFINITIONS "")
# If there were KPMcore API variations, figure them out here
# target_compile_definitions(calapmcore INTERFACE WITH_KPMcore)
else()
set(KPMcore_API_DEFINITIONS WITHOUT_KPMcore)
target_compile_definitions(calapmcore INTERFACE WITHOUT_KPMcore)
endif()
foreach(d ${KPMcore_API_DEFINITIONS})
target_compile_definitions(calapmcore INTERFACE ${d})
endforeach()
add_library(calamares::kpmcore ALIAS calapmcore)
else()
if(TARGET kpmcore)