Hi,

I'm working on getting our CMake project to build the other libraries we wrote 
and I'm not sure how it needs to be done. Our main code is a git repository and 
inside the repo is a lib/ directory with git submodules for our other 
libraries. 

What is the best way to get the main project to build these submodules? It 
seems like I could use ExternalProject to do it, even though I don't need to 
download/checkout anything, but it also looks like I could just 
add_subdirectory(lib/myLibrary) also. Which is the "best practice"? 

If I go the add_subdirectory route, do I need to namespace my variables 
somehow? For instance, all of our projects use CMAKE_INSTALL_PREFIX to indicate 
the installation directory, but if I were to build them all at once, they need 
to be installed different places, so will the names clash? Do I need to change 
all the variables in each library to be myLibrary_*?

If I use ExternalProject, do I have to then manually add the options to my main 
project's CMakeLists so the user can configure them and then pass them through 
to the submodule's configure step with -D...? 

Is there something else I'm missing in how to do this? It seems like projects 
we maintain and can include as git submodules could/should be built differently 
than projects like Python that we don't include as submodules. But our own 
projects also provide a *Config.cmake, so maybe they could be treated the 
same...

Tim

Tim
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to