[CMake] automatic install of targets
Jan Wurster
Jan.Wurster at icido.de
Mon Nov 17 07:55:27 EST 2008
Hi everyone,
Working on a project on the slightly larger side of things I'm in a
situation where I need to support mainly Visual Studio builds. While
switching to cmake 2.6.2, we've been experiencing an issue in a macro
definition we use to automatically install a target in its post-build
phase. This macro used the cmake-install scripts in a post-build (only
for Visual Studio generators). That way, a target would be immediately
installed at its install location after its successful completion - thus
simplifying debugging work while developping with VS (no need to re-run
the INSTALL project for the whole thing).
Since dependency handling seemingly has been improved in cmake 2.6.2,
the probably correct behaviour now means that a project that gets added
by add_subdirectory now is installed while it's not actually built yet,
leading to a post-build error. This is especially true for projects that
have a dependency to their 'top' target - it's a hen vs eggs problem
after all.
One way to fix this would be to just handle all add_subdirectory calls
in a parallel, global sort of way and never include a subproject in a
project's CMakeLists.txt directly. Since there are a lot of projects in
the complete solution and due to some cleanliness considerations I'd
rather keep the structur the way it is now.
To cut a long story short - is there a better (correct) way to do an
automatic install of targets in their post-build phase? I've found a
rather old reference on this list that suggested that it might be
possible at some time to do something like
ADD_DEPENDENCIES(install all)
but this doesn't seem to work (thought as much, install is not a direct
target that could be used that way).
For debugging, we need to start the complete application from it's out
of source, out of binary install location - it is unfortunately not
possible to use the binary tree.
Thanks very much for any help - best regards,
-.jan.-
More information about the CMake
mailing list