Review Request 114336: Install all includes in a KF5 dir

Aurélien Gâteau agateau at kde.org
Tue Dec 10 08:47:50 UTC 2013


Le lundi 9 décembre 2013 21:56:52 Stephen Kelly a écrit :
> Aurélien Gâteau wrote:
> > target_include_directories(${library} INTERFACE
> > "$<INSTALL_INTERFACE:
> > ${CMAKE_INSTALL_PREFIX}/${${library}_INCLUDE_INSTALL_DIR}>"
> > )
> 
> Note that this makes the resulting package non-relocatable. If using CMake
> 3.0.0, you can specify a relative path here. With 2.8.12, you should use
> $<INSTALL_PREFIX> instead of ${CMAKE_INSTALL_PREFIX} so that the relative
> path stays relative.

Good to know, I must admit I cargo-culted the if(IS_ABSOLUTE) snippet from 
existing code (for example tier1/kwidgetaddons/src/CMakeLists.txt uses it). 
Since we are tied to CMake 2.8.12, the macro would be:

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:            
       $<INSTALL_PREFIX>/${${library}_INCLUDE_INSTALL_DIR}>"
    )
  endif()
endmacro()

Is this correct? Also, do you think adding such a macro to ECM is a good idea?

Aurélien


More information about the Kde-frameworks-devel mailing list