Hi,

I just switched from ExternalProject to add_subdirectory.
The reason for me to switch was
(just discussed a few days ago on this list)
that with ExternalProject there is no automatic way
to get nice IDE project files.
My "reason" to use ExternalProject was that I didn't understand
that I could use add_subdirectory at the time when I switched to CMake.

It seems to me that add_subdirectory is provided for the case that
all sources are managed in common where ExternalProject really
is designed for the case the command is named after.

All of my sources (whether main project or added subdir)
use the same settings, so I have only few variables that
I have to reset when using add_subdirectory; so I don't know
how much effort that would be for you.

For the ExternalProject way I used -D for the external configure
step to transport configuration variables (actually, just one)
to the subprojects.

HTH
Regards
Titus

When using ExternalProject
Am 19.10.2012 15:40, schrieb Tim Gallagher:
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

--

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