[cmake-developers] EXPORT_NAME-genex

Brad King brad.king at kitware.com
Mon May 20 09:01:03 EDT 2013


On 05/20/2013 06:13 AM, Alexander Neundorf wrote:
> On Saturday 18 May 2013, Stephen Kelly wrote:
>> 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:: ...)

What's so bad about the exported targets being called "boost_..."
instead of "boost::..."?  VTK and ITK have worked that way for years.
It is simpler if the name inside the upstream build matches that in
the downstream consumers.

We had some recent discussion about encouraging the convention of
"namespace::" for imported targets, but perhaps we should reconsider
the value and cost.

> I don't think this is needed, IMO it just adds unneeded complexity.

Yes, currently it feels like a solution looking for a problem.

-Brad



More information about the cmake-developers mailing list