Alan W. Irwin wrote: > I am struggling with understanding the recursive make system that > CMake normally employs
CMake employs a 2-level make recursion system that is independent of the directory structure. The first level never builds anything...it just evaluates target-level dependencies with phony targets. That determines the order in which targets must be built. The second level is the build.make for each target. This is where file-level dependencies are evaluated. In your example the file1...fileN rules are showing up in target1's build.make and target2's build.make but they should never be evaluated in the second target. They are pulled in through the additional_file rule's dependencies on them (see below), but they should always be up to date if target2 doesn't build until after target1 finishes. Then only the additional_file rule will be invoked. However if there is no dependency from target2->target1 then both build.make files may be built simultaneously and you get race conditions causing the double evaluations. CMake traces through the dependencies of custom commands in each target. When it is constructing target2 it doesn't know that target1 will also provide rules for the files. If you place the targets in different directories it would not be able to make this extra connection, but then the build would not work correctly unless you add the target-level dependency. Any further explanation here will just duplicate my previous message so I'll stop. -Brad _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
