Moving itemviews to tier2

Aurélien Gâteau agateau at kde.org
Wed Sep 11 15:14:30 UTC 2013


On Wednesday 11 September 2013 15:23:15 Aurélien Gâteau wrote:
> Second, the top-level CMakeLists.txt now looks like this:
> 
>   cmake_minimum_required(VERSION 2.8.11)
> 
>   project(ItemViews)
> 
>   find_package(ECM 0.0.8 REQUIRED NO_MODULE)
>   set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
> 
>   set(REQUIRED_QT_VERSION "5.2.0")
>   find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE
>     COMPONENTS Widgets)
>   find_package(KF5 5.0.0 REQUIRED MODULE
>     COMPONENTS CMake Compiler InstallDirs KCoreAddons)
> 
> itemviews depends on KCoreAddons, so when I ran cmake to build it
> standalone, I expected cmake to report KCoreAddons as a required package,
> but it is listed in the "optional packages" section. How does one tell
> KCoreAddons is *required*?

It has been brought to my attention requiring KCoreAddons like this wrong and 
is going to lead to build failure on clean builds of kdelibs, since it 
attempts to find something which kdelibs builds. So the KF5 part should be in 
a "if(NOT kdelibs_SOURCE_DIR)".

I also found out how to make KCoreAddons required: request it with a 
find_package() call. Here is my new version, does it make sense to you?

   cmake_minimum_required(VERSION 2.8.11)
 
   project(ItemViews)
 
   find_package(ECM 0.0.8 REQUIRED NO_MODULE)
   set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
 
   set(REQUIRED_QT_VERSION "5.2.0")
   find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE
     COMPONENTS Widgets)
   if(NOT kdelibs_SOURCE_DIR)
     find_package(KF5 5.0.0 REQUIRED MODULE
       COMPONENTS CMake Compiler InstallDirs)
     find_package(KCoreAddons 5.0.0 REQUIRED)
   endif()

Aurélien


More information about the Kde-frameworks-devel mailing list