[CMake] Selecting INSTALL target in Visual Studio Configuration by default

Paul Baumer paul.baumer2 at googlemail.com
Sun Apr 24 10:06:00 EDT 2011


Thanks for your help. I have just tried this. But there is a cyclic
dependency issue.

install_after_all calls "install" which depends on "ALL_BUILD" and tries to
build "install_after_all".

Possible solutions:
a. break the "install" - "ALL_BUILD" dependency. This sounds kind of
unhealthy.
b. remove "install_after_all" from ALL_BUILD. What would be the appropriate
way of doing this?

Again, thanks for your help!.

Paul


On Mon, Mar 14, 2011 at 5:07 PM, David Cole <david.cole at kitware.com> wrote:

> On Mon, Mar 14, 2011 at 10:16 AM, Paul Baumer
> <paul.baumer2 at googlemail.com> wrote:
> > Sorry for not being clear enough. I meant (2).
> >
> >> (2) included in the "Build Solution" command, executing after all
> >> other targets have been built, so that "F7" or "Build All" will
> >> actually build the INSTALL target?
> >>
> >
> >
>
> In CMake's C++ code, in the
> cmGlobalGenerator::CreateDefaultGlobalTargets method, the "install"
> target depends on the "all" target. (i.e. -- all has to be up-to-date
> before the install rules can be run...)
>
> The net result of this is that:
>
>  make install
>
> ...will build things first, if necessary, before executing the install
> scripts to copy files around.
>
> What you are asking for is for "install" to be *included* in "all" --
> which is difficult to do, since, traditionally, people are used to
> install depending on all.
>
> One way you could nearly achieve this, without any sort of CMake C++
> changes at all, would be to add a custom target at the bottom of the
> top level CMakeLists.txt file, which would execute "make install"
> *after* all other targets are built. You could even do it generically,
> regardless of the underlying build system being used, by using
> something like this in a custom target or custom command call:
>
>  add_executable(exe1 ...)
>  add_executable(exe2 ...)
>  install( ... install rules for all libs and exes here ...)
>  ...
>  add_custom_target(install_after_all ALL
>    COMMAND ${CMAKE_COMMAND} --build . --target install --config
> ${CMAKE_CFG_INTDIR}
>  )
>  add_dependencies(install_after_all exe1 exe2 ... any other
> "important" target names here, too ... )
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110424/ef77aa27/attachment.htm>


More information about the CMake mailing list