Thanks for your help. I have just tried this. But there is a cyclic dependency issue.<br><br>install_after_all calls "install" which depends on "ALL_BUILD" and tries to build "install_after_all".<br>
<br>Possible solutions:<br>a. break the "install" - "ALL_BUILD" dependency. This sounds kind of unhealthy.<br>b. remove "install_after_all" from ALL_BUILD. What would be the appropriate way of doing this?<br>
<br>Again, thanks for your help!.<br><br>Paul<br><br><br><div class="gmail_quote">On Mon, Mar 14, 2011 at 5:07 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Mon, Mar 14, 2011 at 10:16 AM, Paul Baumer<br>
<div class="im"><<a href="mailto:paul.baumer2@googlemail.com">paul.baumer2@googlemail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> Sorry for not being clear enough. I meant (2).<br>
><br>
>> (2) included in the "Build Solution" command, executing after all<br>
>> other targets have been built, so that "F7" or "Build All" will<br>
>> actually build the INSTALL target?<br>
>><br>
><br>
><br>
<br>
</div></div>In CMake's C++ code, in the<br>
cmGlobalGenerator::CreateDefaultGlobalTargets method, the "install"<br>
target depends on the "all" target. (i.e. -- all has to be up-to-date<br>
before the install rules can be run...)<br>
<br>
The net result of this is that:<br>
<br>
make install<br>
<br>
...will build things first, if necessary, before executing the install<br>
scripts to copy files around.<br>
<br>
What you are asking for is for "install" to be *included* in "all" --<br>
which is difficult to do, since, traditionally, people are used to<br>
install depending on all.<br>
<br>
One way you could nearly achieve this, without any sort of CMake C++<br>
changes at all, would be to add a custom target at the bottom of the<br>
top level CMakeLists.txt file, which would execute "make install"<br>
*after* all other targets are built. You could even do it generically,<br>
regardless of the underlying build system being used, by using<br>
something like this in a custom target or custom command call:<br>
<br>
add_executable(exe1 ...)<br>
add_executable(exe2 ...)<br>
install( ... install rules for all libs and exes here ...)<br>
...<br>
add_custom_target(install_after_all ALL<br>
COMMAND ${CMAKE_COMMAND} --build . --target install --config<br>
${CMAKE_CFG_INTDIR}<br>
)<br>
add_dependencies(install_after_all exe1 exe2 ... any other<br>
"important" target names here, too ... )<br>
</blockquote></div><br>