摘自:https://stackoverflow.com/questions/21882071/relative-path-on-cmake-errors-if-path-is-changed-afterwards

Even that the question is downvoted I will provide an answer here for people that are facing the same problem (and depending on their environment it can be real a problem in my opinion).

I removed from all project files that are referenced from my solution at least the following part:

<ItemGroup><CustomBuild Include="..\..\Source\CMakeLists.txt"><Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Building Custom Rule C:/cmake/Source/CMakeLists.txt</Message><Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">setlocal
"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:/cmake -BC:/cmake/build --check-stamp-file C:\cmake\build\Source\CMakeFiles\generate.stamp
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command><AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:/cmake/Source/CMakeLists.txt;C:\cmake\Source\CMakeLists.txt;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.cmake;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.c.in;C:\cmake\Source\cmConfigure.cmake.h.in;C:\cmake\Source\cmVersionConfig.h.in;C:\cmake\Source\CPack\cmCPackConfigure.h.in;C:\cmake\Source\CMakeLists.txt;%(AdditionalInputs)</AdditionalInputs><Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cmake\build\Source\CMakeFiles\generate.stamp</Outputs><LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects><Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Building Custom Rule C:/cmake/Source/CMakeLists.txt</Message><Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">setlocal
"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:/cmake -BC:/cmake/build --check-stamp-file C:\cmake\build\Source\CMakeFiles\generate.stamp
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command><AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:/cmake/Source/CMakeLists.txt;C:\cmake\Source\CMakeLists.txt;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.cmake;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.c.in;C:\cmake\Source\cmConfigure.cmake.h.in;C:\cmake\Source\cmVersionConfig.h.in;C:\cmake\Source\CPack\cmCPackConfigure.h.in;C:\cmake\Source\CMakeLists.txt;%(AdditionalInputs)</AdditionalInputs><Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\cmake\build\Source\CMakeFiles\generate.stamp</Outputs><LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects><Message Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">Building Custom Rule C:/cmake/Source/CMakeLists.txt</Message><Command Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">setlocal
"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:/cmake -BC:/cmake/build --check-stamp-file C:\cmake\build\Source\CMakeFiles\generate.stamp
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command><AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">C:/cmake/Source/CMakeLists.txt;C:\cmake\Source\CMakeLists.txt;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.cmake;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.c.in;C:\cmake\Source\cmConfigure.cmake.h.in;C:\cmake\Source\cmVersionConfig.h.in;C:\cmake\Source\CPack\cmCPackConfigure.h.in;C:\cmake\Source\CMakeLists.txt;%(AdditionalInputs)</AdditionalInputs><Outputs Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">C:\cmake\build\Source\CMakeFiles\generate.stamp</Outputs><LinkObjects Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">false</LinkObjects><Message Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">Building Custom Rule C:/cmake/Source/CMakeLists.txt</Message><Command Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">setlocal
"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:/cmake -BC:/cmake/build --check-stamp-file C:\cmake\build\Source\CMakeFiles\generate.stamp
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command><AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">C:/cmake/Source/CMakeLists.txt;C:\cmake\Source\CMakeLists.txt;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.cmake;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckIncludeFile.c.in;C:\cmake\Source\cmConfigure.cmake.h.in;C:\cmake\Source\cmVersionConfig.h.in;C:\cmake\Source\CPack\cmCPackConfigure.h.in;C:\cmake\Source\CMakeLists.txt;%(AdditionalInputs)</AdditionalInputs><Outputs Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">C:\cmake\build\Source\CMakeFiles\generate.stamp</Outputs><LinkObjects Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">false</LinkObjects></CustomBuild></ItemGroup>

And:

<ItemGroup><ProjectReference Include="C:/cmake/build/ZERO_CHECK.vcxproj"><Project>FE0DC35D-28F6-4786-A563-DFE14862A57F</Project></ProjectReference>
</ItemGroup>

That prevents the behaviour that CMakeLists.txt is checked for changes before each build. If all other paths in the project file are relative the cmake project is free moveable on the harddisk now.

The Problem with this custom build step is: It isn't displayed in Visual Studios Project Settings, so the plain .vcxproj must be edited manually.

share  improve this answer  follow

CMake is re-running because generate.stamp.list is missing.相关推荐

  1. 在CentOS/Debian/Ubuntu上编译安装最新版 GCC 8 , cmake 3 和ninja

    CentOS不像Debian/Ubuntu,不能直接从官方库中安装最新版的gcc/g++,只能源码编译安装. gcc下载地址:Index of /gnu/gcc 我选择了最新版本 gcc-8.3.0, ...

  2. generate报错 make_如何安装opencv_contrib及解决其安装编译问题

    1.背景 最近在实现一个基于opencv3的自动人脸识别项目,主要是使用了cv2.face模块自带的三种人脸识别算法,分别是cv2.face.EigenFaceRecognizer_create(). ...

  3. windows平台下用CMake工具编译osg用法说明

    最近研究osg,用CMake工具将osg源码转为VS下的工程.解决方案,开始时不懂,走了很多弯路,现在将自己理解的记录如下: 1):在CMake图形界面中的"Where is the sou ...

  4. android代码导入有错误,android新项目导入后进行编译出现cmake错误

    问题描述 使用as加载并且gradle sync 提示:SIMPLE:error configure 同时使用make project 提示 问题出现的环境背景及自己尝试过哪些方法 已经尝试更换过nd ...

  5. Introduction to CMake by Example

    Introduction This article provides a straightforward set of "Hello World!" introductions t ...

  6. 安装MySQL时cmake包的依赖问题

    cmake安装过程: [root@localhost ~]# tar -zxvf cmake-2.8.10.2.tar.gz [root@localhost ~]# cd cmake-2.8.10.2 ...

  7. CentOS7 安装 CMake 解决 cmake command not found 问题

    下载 https://github.com/Kitware/CMake/releases [root@ALiYunOgenes ~]# wget https://github.com/Kitware/ ...

  8. Ubuntu18.04 Cmake安装,报错openssl

    ubuntu18.04下, 下载cmake-3.18.2.tar.gz, tar xvf cmake-3.18.2.tar.gz cd cmake-3.18.2 ./bootstrap sudo ma ...

  9. 20190503(cmake安装,利用libwebsockets库去实现http服务器,websocket服务器,虚拟机安装)

    目录 1.libwebsockets简介安装 2.libwebsockets实现简易http服务器 3.实现简易websocket服务器 4.websocket介绍 5.虚拟机安装 1.libwebs ...

  10. CMake安装时报错:The current CMakeCache.txt directory /home/joes/jiao/01_YHWorker/03_setupbag/cmake-3.19.2

    一.问题描述: CMake Error: The current CMakeCache.txt directory /home/joes/jiao/01_YHWorker/03_setupbag/cm ...

最新文章

  1. 半透明遮罩层覆盖整个可视区域
  2. 由4G向5G进发的物联网:NB-IoT与LTE-M
  3. 矩阵元素求积及其矩阵元素的差分
  4. 6行Python实现验证码识别,太稳了!
  5. 如何把a1的图纸变成a0_如何安装家用空开配电
  6. 设计模式:面向对象的设计原则下(ISP、DIP、KISS、YAGNI、DRY、LOD)
  7. Spark 键值对RDD操作
  8. 4-5 求自定类型元素的最大值 (10分)
  9. 学习之法 —— 概念、名词、术语与定义的学习
  10. 算法学习之路|互评成绩计算
  11. nginx配置错误页面的2种方式
  12. arcpy投影(一)——prj、gtf文件定义、路径及解析(arcmap,arcpro)
  13. Excel IRR函数告诉你信用卡分期、贷款的实际利率
  14. Datawhale组队学习周报(第046周)
  15. 青龙面板关闭青龙二级验证
  16. 给猫起名字的几种姿势
  17. 求教Latex的双栏表格排版
  18. Docker容器-----Consul部署
  19. 无人驾驶技术架构、方向及技能要求
  20. 前端开发行业真的会被AI取代吗?

热门文章

  1. 电子技术基础(三)_第3章集成运算放大器及其应用__基本运算电路
  2. 数字信号处理:时域采样定理与频域采样定理
  3. 数字交通灯设计(Multisim仿真+PCB实物)
  4. panasonic打印机驱动下载
  5. 巧做“士兵突击”的个性日历
  6. 飞鸽传书2007绿色版,提取、识别不同的重点
  7. 中国互联网发展报告(2021)
  8. X8AIP 驱动程序
  9. fseek(f,0,SEEK_SET);
  10. 元气骑士里面的超级计算机,元气骑士古大陆的神器神威大全