CMake: create an alias for KPMcore that fixes its interface
- kpmcore (when used as target "kpmcore") has an interface include directory that does not contain the "kpmcore/" subdirectory. But the headers it has installed, assume it is there (e.g. kpmcore internals use #include <fs/filesystem.h>). - add an alias at Calamares level that sticks in some more includes, adds the relevant WITHOUT_kpmcore when it's not there, etc.
This commit is contained in:
parent
ab813b607f
commit
fb620464d7
@ -7,28 +7,49 @@
|
|||||||
#
|
#
|
||||||
# Finds KPMcore and consistently sets API flags based on the version.
|
# Finds KPMcore and consistently sets API flags based on the version.
|
||||||
#
|
#
|
||||||
if ( NOT KPMcore_searched_for )
|
# 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)
|
set(KPMcore_searched_for TRUE)
|
||||||
|
|
||||||
find_package( KPMcore 21.12.0 )
|
find_package(KPMcore 20.04.0)
|
||||||
set_package_properties(
|
set_package_properties(
|
||||||
KPMcore PROPERTIES
|
KPMcore
|
||||||
|
PROPERTIES
|
||||||
URL "https://invent.kde.org/kde/kpmcore"
|
URL "https://invent.kde.org/kde/kpmcore"
|
||||||
DESCRIPTION "KDE Partitioning library"
|
DESCRIPTION "KDE Partitioning library"
|
||||||
TYPE RECOMMENDED
|
TYPE RECOMMENDED
|
||||||
PURPOSE "For disk partitioning support"
|
PURPOSE "For disk partitioning support"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Create an internal Calamares interface to KPMcore
|
||||||
|
# and give it a nice alias name. If kpmcore is not found,
|
||||||
|
# then make a "no KPMcore" library.
|
||||||
|
add_library(calapmcore INTERFACE)
|
||||||
|
|
||||||
|
if(KPMcore_FOUND)
|
||||||
find_package(Qt5 REQUIRED DBus) # Needed for KPMCore
|
find_package(Qt5 REQUIRED DBus) # Needed for KPMCore
|
||||||
find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore
|
find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore
|
||||||
|
|
||||||
if( KPMcore_FOUND )
|
target_link_libraries(calapmcore INTERFACE kpmcore Qt5::DBus KF5::I18n KF5::WidgetsAddons)
|
||||||
|
target_include_directories(calapmcore INTERFACE ${KPMCORE_INCLUDE_DIR})
|
||||||
set(KPMcore_API_DEFINITIONS "")
|
set(KPMcore_API_DEFINITIONS "")
|
||||||
else()
|
else()
|
||||||
set(KPMcore_API_DEFINITIONS WITHOUT_KPMcore)
|
set(KPMcore_API_DEFINITIONS WITHOUT_KPMcore)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(d ${KPMcore_API_DEFINITIONS})
|
foreach(d ${KPMcore_API_DEFINITIONS})
|
||||||
target_compile_definitions(kpmcore INTERFACE ${d})
|
target_compile_definitions(calapmcore INTERFACE ${d})
|
||||||
endforeach()
|
endforeach()
|
||||||
target_include_directories(kpmcore INTERFACE ${KPMCORE_INCLUDE_DIR})
|
|
||||||
|
add_library(calamares::kpmcore ALIAS calapmcore)
|
||||||
|
else()
|
||||||
|
if(TARGET calapmcore)
|
||||||
|
message(STATUS "KPMcore has already been found")
|
||||||
|
set(KPMcore_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
message(STATUS "KPMcore has been searched-for and not found")
|
||||||
|
set(KPMcore_FOUND FALSE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user