I have a few different cmake based projects that depend on each other (as a 
tree, no circular dependencies).  Mostly this works great, but a few people 
have expressed interested in a superbuild which builds everything together for 
various purposes.  I can make this work with ExternalProject, but that isn't a 
useful solution for IDE users.  I'm trying to use add_subdirectory and running 
into a problem with namespaces in my export files

Currently projectA has
   EXPORT(projectA NameSpace ProjectA_)
Which works great, when projectB wants to link to a library in projectA it is 
just FIND_PACKAGE(ProjectA) then TARGET_LINK_LIBRARIES(lib 
ProjectA_LibraryName).  Simple enough without superbuilds.

When I get to a superbuild though I don't know how to handle this.  It is easy 
to do write some sort of FindProjectA.cmake or ProjectAConfig.cmake file to 
make the FIND_PACKAGE work in projectB. However I don't know how to get a 
ProjectA_LibraryName target that I can link to, the superbuild only knows about 
LibraryName without the namespace.

The only idea I can think of is in the superbuild have a bunch of ADD_LIBRARY 
(ProjectA_LibraryName ALIAS LibraryName) lines hard coded. This means I have to 
maintain that file though which I don't like. Does anyone have a better idea?


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to