Hello,
I am adding several third-party projects as static libraries in my project.
This is what I do:
CMakeLists.txt
|
\-- 3rdparty
|
\---- pugixml
|
\---- QtZeroConf
|
\---- QtDropBox
|
\---- websocketpp
In the root CMakeLists.txt, I have:
add_subdirectory(3rdparty)
And in 3rdparty/CMakeLists.txt:
add_subdirectory(pugixml/scripts)
add_subdirectory(QtZeroConf)
add_subdirectory(QtDropBox)
add_subdirectory(websocketpp)
This is an easy way to work with third-party dependences.
My problem comes from the fact several of these third-party libraries use
common variable names, e. g. BUILD_SHARED, BUILD_TESTS, etc).
Has some kind of namespacing been considered for add_subdirectory?
E. g.
add_subdirectory(QtZeroConf NAMESPACE QTZEROCONF)
Which would lead to all the variables defined QtZeroConf/CMakeLists.txt
having a QTZEROCONF_ prefix, e. g. instead of BUILD_SHARED it would now be
QTZEROCONF_BUILD_SHARED.
Or, as an alternative:
add_subdirectory QtZeroConf NAMESPACE QtZeroConf)
and variables would be prefixed by QtZeroConf::, e. g. BUILD_SHARED would
now be QtZeroConf::BUILD_SHARED.
Does that sound sensible?
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
--
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-developers