Alexander Neundorf wrote: >> > We shouldn't expect from all our developers that they suddenly take >> > care of all that themselves. >> >> Every KDE application I have seen has this boilerplate: >> >> find_package(KDE4 REQUIRED) >> include(KDE4Defaults) >> include(MacroLibrary) >> include(CheckIncludeFiles) >> >> Why don't we set the flags in KDE4Defaults? > > ...so you would do > > find_package(kitemmodels REQUIRED) > which sets a bunch of include dir and libs variables, and then > > include(KDE4Defaults) > which sets compilers flags etc.
Yes, 'KDE Applications' can do that. They will likely use find_package a bunch of more times too, or they would use find_package(kdelibs 5.0)[1] which internally calls find_package for all frameworks, or whatever. Then they could use include(KDE4Defaults). However, a 'non-kde consumer of the frameworks' would do find_package(kitemmodels REQUIRED) include(${kitemmodels_USE_FILE}) kitemmodels_USE_FILE is generated by ECMQtFramework and currently does very little. Currently it can't be modified, but we could make it so by renaming it to kitemmodelsUSE_internal.cmake, and then create a kitemmodelsUSE.cmake which looks like: include(kitemmodelsUSE_internal) set(CMAKE_CXX_FLAGS ...) in cases where the library requires that. In the case of kitemmodels I don't think we need to set any compiler flags. As a frameworks user I would be surprised if the framework set compiler flags automatically for me. As a 'KDE application' developer I can of course see the reasoning, and of course agree that it should do that. > > I think this sounds quite good. Yes, I agree. > We could also rename that file to UseKDE4.cmake, so it is similar to > UseQt4.cmake. > Yes, I agree. > Still, where will the file KDE4Defaults.cmake (or UseKDE4.cmake) be > located ? I'd put it wherever KApplication goes and install it from there. I'd also recommend creating and installing a kdelibsTargets file which includes the targets for all relevant frameworks. All the best, Steve.