[CMake] Problem with Visual Studio, custom commands, and dependencies. Bug?

Yuri Timenkov yuri at timenkov.ru
Thu Jun 21 13:32:27 EDT 2012


I'm not sure but this may be "feature" of msbuild: it doesn't rescan
dependencies after run. This causes a lot of troubles with generated
code (for same reason auto-reloading macro doesn't work since VS2010).

You may try to work this around by splitting build into several stages
(i.e. adding custom targets containing only custom commands, probably
adding later target-level dependencies).

On Wed, May 9, 2012 at 11:04 PM, Jensen, Erik A <Erik.Jensen at pnnl.gov> wrote:
> Part of my build involves generating an archive of several files. To do
> this, I have custom commands for copying each file into a directory (some
> from the source tree, some from the build tree), a custom command for
> generating the archive, and a custom target that depends on the latter
> custom command. Each copy command depends on its source file, and the
> archive command depends on all of the destination files.
>
>
>
> This works fine with NMake files, but I have noticed a problem with Visual
> Studio 2010 solution files: when I modify a source file and build, the
> command to copy the file into the directory is run, but the command to build
> the archive is not run unless I run build a second time. It seems that
> Visual Studio checks the dependencies for the archive command before running
> the copy commands, so it doesn’t pick up the changed files until a
> subsequent run.
>
>
>
> Is this a known limitation, or a bug in the generated files? It seems like
> it could be solved in this case by also including dependencies of
> dependencies in the generated project files, but I haven’t thought about it
> enough to know if that would cause other problems.
>
>
>
> Thanks.
>
> -- Erik
>
>
> --
>
> 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


More information about the CMake mailing list