I have a VS 12 solution with my own project, which depends on some dependencies (project files generated using cmake). I generated these VS12 projects using cmake and added these projects to my solution (using a relative path). Then I had to adjust the output directories of these projects, to build the target somewhere else where my own project can find them (so just running cmake again after the path changes doesn't solve my problem, because I would have to edit all projects again then).
If now the absolute path for the solution changes, the solution can still find the projects - but at building I receive errors from cmake, that the "old path" didn't exists.
Steps to reproduce my problem:
- Download the cmake Project from here.
- Extract into a Directory on
C:\cmake
- Create inside a Directory called
C:\cmake\build
- Open a command-line and go to
C:\cmake\build
- execute
cmake ..
- rename the
C:\cmake
Directory toC:\cmake2
- Open the solution
C:\cmake2\build\CMake.sln
There will occur a long list with errors (too long to include here completly) - all caused because the old path "C:\cmake\" ist still used from somewhere. An example:
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration
1> Checking Build System
1> CMake is re-running because C:/cmake/build/CMakeFiles/generate.stamp dependency file is missing.
1>CUSTOMBUILD : CMake error : The source directory "C:/cmake" does not appear to contain CMakeLists.txt.
1> Specify --help for usage, or press the help button on the CMake GUI.
3>------ Build started: Project: cmbzip2, Configuration: Debug Win32 ------
4>------ Build started: Project: cmzlib, Configuration: Debug Win32 ------
5>------ Build started: Project: cmexpat, Configuration: Debug Win32 ------
6>------ Build started: Project: cmsys, Configuration: Debug Win32 ------
3>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1422,5): warning : The referenced project 'C:/cmake/build/ZERO_CHECK.vcxproj' does not exist.
I want to generate VS Project files just one time - not again, if the Location of the folder changes. Any ideas how cmake can make use of relative paths instead?