我的 CMakeLists.txt 如下所示(我认为 CMakeLists.txt 的内容并不重要,因为代码在 Linux 上使用 CLion 编译得很好,但包括细节应该不会有任何坏处):
cmake_minimum_required(VERSION 3.12)
project(ambulance)
set(CMAKE_CXX_STANDARD 14)
if (UNIX)
set(CMAKE_CXX_FLAGS " -pthread ")
include_directories(ambulance builder control include include/unix io main model view)
add_executable(ambulance
control/Ambulance.cpp
control/Ambulance.h
main/main.cpp
view/AmbulanceUI.cpp
view/AmbulanceUI.h
model/Doctor.cpp
model/Doctor.h
model/Patient.cpp
model/Patient.h
control/PatientAdmin.cpp
control/PatientAdmin.h
model/Person.cpp
model/Person.h
control/DoctorAdmin.cpp
control/DoctorAdmin.h
model/Treatment.cpp
model/Treatment.h
io/PeopleIO.h
io/AmbulancePersistence.cpp
io/AmbulancePersistence.h
io/AmbulancePeopleIOElement.cpp
io/AmbulancePeopleIOElement.h
builder/PatientBuilder.cpp
builder/PatientBuilder.h
builder/DoctorBuilder.cpp
builder/DoctorBuilder.h
builder/PersonBuilder.cpp
builder/PersonBuilder.h
include/json_macro.h
include/system_macro.h
control/ScheduleAdmin.cpp
control/ScheduleAdmin.h
model/ScheduleElement.cpp
model/ScheduleElement.h
model/DailySchedule.cpp
model/DailySchedule.h
include/unix/Logger.h
include/unix/Logger.cpp
include/json.hpp
logger/Logger.h
logger/Logger.cpp)
else ()
include_directories(ambulance builder control include include/win io main model view)
add_executable(ambulance
include/json.hpp
control/Ambulance.cpp
control/Ambulance.h
main/main.cpp
view/AmbulanceUI.cpp
view/AmbulanceUI.h
model/Doctor.cpp
model/Doctor.h
model/Patient.cpp
model/Patient.h
control/PatientAdmin.cpp
control/PatientAdmin.h
model/Person.cpp
model/Person.h
control/DoctorAdmin.cpp
control/DoctorAdmin.h
model/Treatment.cpp
model/Treatment.h
io/PeopleIO.h
io/AmbulancePersistence.cpp
io/AmbulancePersistence.h
io/AmbulancePeopleIOElement.cpp
io/AmbulancePeopleIOElement.h
builder/PatientBuilder.cpp
builder/PatientBuilder.h
builder/DoctorBuilder.cpp
builder/DoctorBuilder.h
builder/PersonBuilder.cpp
builder/PersonBuilder.h
include/json_macro.h
include/system_macro.h
include/win/Logger.h
include/win/Logger.cpp
control/ScheduleAdmin.cpp
control/ScheduleAdmin.h
model/ScheduleElement.cpp
model/ScheduleElement.h
model/DailySchedule.cpp
model/DailySchedule.h
logger/Logger.cpp
logger/Logger.h)
endif (UNIX)
这里是CMakeSettings.txt的内容
{
"configurations": [
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${env.USERPROFILE}\CMakeBuilds\${workspaceHash}\build\${name}",
"installRoot": "${env.USERPROFILE}\CMakeBuilds\${workspaceHash}\install\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
我主要在 Linux 上编写代码,并在装有 Visual Studio Enterprise 的 Windows 10 虚拟机上进行编译。昨天构建仍然成功,但从今天开始每次我尝试编译它时,我都有一个无限循环说:
[0/1] "...cmake.exe" ".../x64-Release" -- Configuring done -- Generating done -- Build files have been written to: ...
最后错误描述说:
manifest 'build.ninja' still dirty after 100 tries
有什么解决方案?我必须重新安装 visual studio(因为我的虚拟机非常慢,所以非常不舒服)。
谢谢
最佳答案
我遇到了完全相同的问题。就我而言,运行一个递归设置源文件夹(源,不是构建文件夹)上的所有文件时间戳的工具很有帮助。我假设某个工具将其中一个源文件更新到将来的某个时间,这使得 cmake 认为它必须重新生成,因为源文件比构建文件更新。也许这对您也有帮助?
这是我使用的工具:http://www.binarez.com/touch_dot_exe/
只需在命令行上使用它:
touch.exe -R C:/my/source/folder
关于带有 CMake 错误 : manifest 'build.ninja' still dirty after 100 tries 的 Visual Studio 上的 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53771471/