diff options
author | Alex Neundorf <neundorf@kde.org> | 2013-02-08 00:47:34 +0100 |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2013-02-08 00:49:00 +0100 |
commit | aad12f8137972642495cb1a0ac0253f2fffcb9d1 (patch) | |
tree | 7fcb9aedbe01f2ca8bbf2f513e741dd1e476cf48 | |
parent | 40b310c15bfeeec7d9fccf477e5c77bd33b04d96 (diff) | |
download | extra-cmake-modules-aad12f8137972642495cb1a0ac0253f2fffcb9d1.tar.gz extra-cmake-modules-aad12f8137972642495cb1a0ac0253f2fffcb9d1.tar.bz2 |
some FindKF5.cmake improvements, increase to version 0.0.7
- added some docs
- now a KF5_INCLUDE_DIRS variable is set, containing all requested include dirs
- the same for KF5_LIBRARIES
- some more status reporting
Alex
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | find-modules/FindKF5.cmake | 48 |
2 files changed, 43 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b75d57f7..10d012aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(extra-cmake-modules) set(ECM_MAJOR_VERSION 0) set(ECM_MINOR_VERSION 0) -set(ECM_PATCH_VERSION 6) +set(ECM_PATCH_VERSION 7) set(ECM_VERSION ${ECM_MAJOR_VERSION}.${ECM_MINOR_VERSION}.${ECM_PATCH_VERSION}) diff --git a/find-modules/FindKF5.cmake b/find-modules/FindKF5.cmake index 42fa07d8..beb9bef6 100644 --- a/find-modules/FindKF5.cmake +++ b/find-modules/FindKF5.cmake @@ -1,3 +1,9 @@ +# Finds KDE frameworks 5 and its components, like e.g. karchive +# +# KF5_INCLUDE_DIRS - the include dirs of all requested components +# KF5_<comp>_LIBRARIES - the libraries to link against of all requested components +# KF5_<comp>_FOUND - signals whether the requested component <comp> has been found + # hmm, any better ideas ? set(KF5_VERSION_STRING "5.0.0") @@ -66,22 +72,51 @@ if(DEFINED unknownComponents) return() endif() +get_filename_component(_kf5KdeModuleDir "${CMAKE_CURRENT_LIST_DIR}/../kde-modules" REALPATH) if(installDirsCompRequested) - include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDEInstallDirs.cmake) + include("${_kf5KdeModuleDir}/KDEInstallDirs.cmake") + if(NOT KF5_FIND_QUIETLY) + message(STATUS "KF5[InstallDirs]: Loaded settings from ${_kf5KdeModuleDir}/KDEInstallDirs.cmake") + endif() set(KF5_InstallDirs_FOUND TRUE) endif() if(cmakeCompRequested) - include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDECMakeSettings.cmake) + include("${_kf5KdeModuleDir}/KDECMakeSettings.cmake") + if(NOT KF5_FIND_QUIETLY) + message(STATUS "KF5[CMake]: Loaded settings from ${_kf5KdeModuleDir}/KDECMakeSettings.cmake") + endif() set(KF5_CMake_FOUND TRUE) endif() if(compilerCompRequested) - include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDECompilerSettings.cmake) + include("${_kf5KdeModuleDir}/KDECompilerSettings.cmake") + if(NOT KF5_FIND_QUIETLY) + message(STATUS "KF5[Compiler]: Loaded settings from ${_kf5KdeModuleDir}/KDECompilerSettings.cmake") + endif() set(KF5_Compiler_FOUND TRUE) endif() +unset(KF5_INCLUDE_DIRS) +unset(KF5_LIBRARIES) + + +macro(_KF5_HANDLE_COMPONENT _comp) + set(KF5_${_comp}_FOUND TRUE) + if(NOT KF5_FIND_QUIETLY) + message(STATUS "KF5[${_comp}]: Loaded ${${_comp}_CONFIG}") + endif() + if(NOT DEFINED ${_comp}_INCLUDE_DIRS) + message(FATAL_ERROR "${_comp} does not set ${_comp}_INCLUDE_DIRS !") + endif() + if(NOT DEFINED ${_comp}_LIBRARIES) + message(FATAL_ERROR "${_comp} does not set ${_comp}_LIBRARIES !") + endif() + set(KF5_INCLUDE_DIRS ${KF5_INCLUDE_DIRS} ${${_comp}_INCLUDE_DIRS} ) + set(KF5_LIBRARIES ${KF5_LIBRARIES} ${${_comp}_LIBRARIES} ) +endmacro() + if(firstComponent) file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS) @@ -94,10 +129,11 @@ if(firstComponent) set(KF5_File "${${firstComponent}_CONFIG}}") if(${firstComponent}_CONFIG) - set(KF5_${firstComponent}_FOUND TRUE) if(NOT DEFINED ${firstComponent}_INSTALL_PREFIX) message(STATUS "${firstComponent} does not set ${firstComponent}_INSTALL_PREFIX !") endif() + + _kf5_handle_component(${firstComponent}) endif() # search for the other components first in the same directory where the first one @@ -115,9 +151,9 @@ if(firstComponent) NO_CMAKE_SYSTEM_PACKAGE_REGISTRY ) if(${comp}_CONFIG) - set(KF5_${comp}_FOUND TRUE) + _kf5_handle_component(${comp}) + endif() - message(STATUS "${comp}: ${${comp}_CONFIG}") endforeach() set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH} ) |