VS: Prefix the --check-stamp-list command for ZERO_CHECK/generate.stamp.rule with a $(ProjectDir) MSbuild property
We generate a large solution with plenty of dependencies using add_subdirectory commands. CMake not only generates a solution for the top level project, but also for each sub project. The benefit of this subproject .sln is that it contains only its own dependent projects, along with the CMake predefined ZERO_CHECK, ALL_BUILD and INSTALL targets. However, when running ZERO_CHECK or if regeneration is on, the build system checks against the wrong generate.stamp.list:
ZERO_CHECK -> CMake Rules -> generate.stamp.rule -> Custom Build Tool -> Command Line:
C:\git\fw\.bin\cmake\bin\cmake.exe -SR:/Build/cmake_VS -BR:/Build/cmake_VS --check-stamp-list CMakeFiles/generate.stamp.list --vs-solution-file R:/Build/cmake_VS/Mother.sln
The --check-stamp-list CMakeFiles/generate.stamp.list
command is run in the directory of the child solution. Correct would be --check-stamp-list $(ProjectDir.Replace('\\','/'))/CMakeFiles/generate.stamp.list
, where the ProjectDir would be evaluated to the directory of the ZERO_CHECK project.
Perhaps the problem is aggravated in our situation because we can also generate the child lib stand alone, and it may even contain ./CMakeFiles/generate.stamp.list
from a different cmake run.