Review Request 114336: Install all includes in a KF5 dir

Aurélien Gâteau agateau at kde.org
Mon Dec 9 17:53:26 UTC 2013


Le samedi 7 décembre 2013 14:51:33 Stephen Kelly a écrit :
> Aurélien Gâteau wrote:
> >> On Dec. 6, 2013, 5:15 p.m., Alexander Richardson wrote:
> >> > Just wondering, should include/KF5 also be the include dir for
> >> > applications that install headers e.g. for writing plugins? Since I
> >> > guess they will also be using KDEInstallDirs.cmake
> > 
> > Good question. This was not discussed in the thread. I would say
> > include/KF5 should only be used by frameworks, to be consistent with our
> > library naming (using libKF5 as a prefix). This means the change should be
> > done for each framework instead of in ecm. If everybody agrees, I can
> > discard this RR and do the change in kdelibs only.
> 
> It might make sense for ECM to provide different settings for KF5-frameworks
> and for non-KF5-frameworks. Eg, instead of INSTALL_TARGETS_DEFAULT_ARGS,
> provide KF5_INSTALL_TARGETS_DEFAULT_ARGS.

Thinking about it while keeping in mind the other message I just sent 
("Installing headers in include/KF5, how to?"), I am wondering if it would not 
be simpler to add something like this to ecm:

macro ecm_library_set_include_prefix(library include_prefix)

set(${library}_INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/${include_prefix})

if(IS_ABSOLUTE "${INCLUDE_INSTALL_DIR}")
  target_include_directories(${library} INTERFACE
    "$<INSTALL_INTERFACE:${${library}_INCLUDE_INSTALL_DIR}>"
  )
else()
  target_include_directories(${library} INTERFACE
    "$<INSTALL_INTERFACE:
${CMAKE_INSTALL_PREFIX}/${${library}_INCLUDE_INSTALL_DIR}>"
  )
endif()

endmacro()

Then a framework providing library Foo and Bar would call:

ecm_library_set_include_prefix(Foo KF5)
ecm_library_set_include_prefix(Bar KF5)

and then install headers with:

install(FILES Foo1.h Foo2.h
    DESTINATION ${Foo_INCLUDE_INSTALL_DIR})

install(FILES Bar1.h Bar2.h
    DESTINATION ${Bar_INCLUDE_INSTALL_DIR})

Would that work?

Aurélien


More information about the Kde-frameworks-devel mailing list