[cmake-developers] EXPORT_NAME-genex

Stephen Kelly steveire at gmail.com
Sat May 18 06:29:20 EDT 2013


Hi,

I've pushed the EXPORT_NAME-genex topic to my clone. It allows 
uniform/generic renaming of targets on export. That means that while 
buildsystem targets might be named boost_any/boost_mpl, they can be exported 
as boost::any/boost::mpl like this:

 set(CMAKE_EXPORT_NAME $<REPLACE:$<TARGET_PROPERTY:NAME>,^boost_,>)

 add_library(boost_any ...)
 add_library(boost_mpl ...)

 install(TARGETS boost_any boost_mpl EXPORT boostTargets ...)
 install(EXPORT boostTargets NAMESPACE boost:: ...)


I'd find 

 add_library(boost_any ...)
 set_property(TARGET boost_any PROPERTY EXPORT_NAME any)

for each target cumbersome and we'd end up with a macro wrapping 
add_library, which I'm trying to avoid and discourage.

KDE might use 

 set(CMAKE_EXPORT_NAME $<REPLACE:$<TARGET_PROPERTY:NAME>,^K,>)

 add_library(KArchive ...)
 add_library(KCoreAddons ...)
 install(EXPORT kdeTargets NAMESPACE KF5:: ...)

to end up with KF5::Archive, KF5::CoreAddons etc. This is more similar to 
Qt5::Core, which does not duplicate the 'Q'.

Comments? Good idea/bad idea?

Thanks,

Steve.



More information about the cmake-developers mailing list