[fsresizer] [partition] Gracefully fail on missing dependencies

- If KPMcore is found -- it requires some other KDE Frameworks but
   at least in pre-4.0 versions doesn't check very well for them --
   then missing its dependencies is no cause for CMake failure.
   Instead, log it nicely and suppress the module.
This commit is contained in:
Adriaan de Groot 2019-08-08 13:32:20 +02:00
parent 8c78a6cdfa
commit a6db224fcb
2 changed files with 18 additions and 10 deletions

View File

@ -1,11 +1,11 @@
find_package( KPMcore 3.3 )
find_package( KF5Config CONFIG )
find_package( KF5I18n CONFIG )
find_package( KF5WidgetsAddons CONFIG )
set( _partition_defs "" )
if ( KPMcore_FOUND )
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND )
include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition )
if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
@ -48,5 +48,9 @@ if ( KPMcore_FOUND )
target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} )
endif()
else()
if ( NOT KPMcore_FOUND )
calamares_skip_module( "fsresizer (missing suitable KPMcore)" )
else()
calamares_skip_module( "fsresizer (missing dependencies for KPMcore)" )
endif()
endif()

View File

@ -22,11 +22,11 @@ set_package_properties(
KPMcore PROPERTIES
PURPOSE "For partitioning module"
)
find_package( KF5Config CONFIG )
find_package( KF5I18n CONFIG )
find_package( KF5WidgetsAddons CONFIG )
if ( KPMcore_FOUND )
find_package( Qt5 REQUIRED DBus )
find_package( KF5 REQUIRED Config CoreAddons I18n WidgetsAddons )
if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND )
if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
list( APPEND _partition_defs WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations
endif()
@ -106,5 +106,9 @@ if ( KPMcore_FOUND )
SHARED_LIB
)
else()
if ( NOT KPMcore_FOUND )
calamares_skip_module( "partition (missing suitable KPMcore)" )
else()
calamares_skip_module( "partition (missing dependencies for KPMcore)" )
endif()
endif()