In order to maximize our ability to rebuild an exact copy of a previous
revision, our repository carries copies of numerous 3rd party libraries.
However, in most of their cases we are fairly selective about which
elements we build.
Downside: make clean make winds up rebuilding all the damn libraries
:)
At the same time, we have a large number of customized project-wide
customizations, depending on which client / product version we're
building for. So, when we are building - as opposed to developing - we
need the ability to easily perform a full rebuild, including possibly
the libraries.
For a nominal development clean build, upto 70% of the build time is
spent building 3rd party libraries.
Right now - for simplicity - we actually assemble the 3rd libraries from
the top level CMakeLists.txt directly (ok, simplicity and a failure on
my part to work out how to express that libraryXXX.a is an output of
subfolderX).
/The problem/
Something like a source-control revert can sometimes put /our/ part of
the code base into a state that requires a clean. However, we don't want
to cause the libraries to rebuild /except/ when someone changes
compilation flags or forces a rebuild of the libraries somehow else
(e.g. a cleanall target).
Is there a way to do this with cmake? Or is this problem only because I
haven't (yet) split these libraries into their own CMakeLists files?
The simplest and therefore easiest complete example I have is:
8x --- snip --- x8
add_library(ircclient SHARED libircclient/src/libircclient.c)
set_property(TARGET ircclient PROPERTY COMPILE_DEFINITIONS
IN_BUILDING_LIBIRC)
link_directories( ${Project_BINARY_DIR}/ircclient )
8x --- snip --- x8
No, you don't want this link_directories() here. You later do
target_link_libraries(something ircclient), which will make CMake fiddle
out the link directory and it's ordering on it's own. Explicitely
specifying link_directories() is almost always wrong and just adding pain.
My way to solve your general problem: have one top level CMakeLists.txt
that just collects the various libraries and then decend into your source
tree:
add_subdirectory(foreign_libA)
add_subdirectory(foreign_libB)
add_subdirectory(our_stuff)
If you want to get rid of your stuff:
cd ~/buildtree/our_stuff make clean make
Eike
--
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