【发布时间】:2018-09-06 16:41:32
【问题描述】:
我正在尝试将一个简单的基于 CMake 的项目从 VS2017 定位到 Linux (x86)。
CMakeLists.txt
project (hello-cmake)
add_executable(hello-cmake hello.cpp)
你好.cpp
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << "Hello from Linux CMake" << std::endl;
}
我的设置:
- 在 Win7 上运行的 Visual Studio 15.8.2
- Ubuntu 16.04
- CMake 3.12.1
- g++ 5.4.0,gcc 5.4.0
我已经仔细阅读了 MSDN 的 website 上的说明,但无法正常工作。
使用 VS 生成的默认 CMakeSettings.json,rsync 命令继续擦除我的“~”目录!
在 VS 中显示的命令下方:
rsync -t --delete --delete-excluded -v -r --exclude=.vs --exclude=.git --exclude=.vs --exclude=.git /D/JP/svn/mirtec/test_cmake_vs2017/ rsync://alex@localhost:60584/temp
我了解 --delete --delete-excluded 的作用。但我不明白为什么它针对我的主目录?
我的意思是如何指定目标机器上将复制文件的位置(我以为是 remoteCMakeListsRoot,但我的经验表明不是)。
我的意思是为 VS/CMake 调试创建一个专用用户吗?
我编辑了 CMakeSettings.json 以删除“--delete --delete-excluded”选项。结果 rsync 停止尝试擦除〜,但现在 VS 说它找不到 CMake!我完全被困住了。我已经安装了 CMake,它在 /usr/local/bin 中可用。我试过在 json 文件中使用和不使用 cmakeExecutable 的程序名称都无济于事。
这是 VS 中的输出:
1> Copying files to remote machine...
1> rsync -t -v -r --exclude=.vs --exclude=.git --exclude=.vs --exclude=.git /D/JP/svn/mirtec/test_cmake_vs2017/ rsync://alex@localhost:56138/temp
1> sending incremental file list
1> ./
1> CMakeSettings.json
1>
1> sent 828 bytes received 42 bytes 580.00 bytes/sec
1> total size is 1349 speedup is 1.55
1> Finished copying files.
1> /usr/local/bin/cmake does not exist
有没有人使用 VS2017 / CMake 集成成功地瞄准 Linux? 你有过类似的问题吗?我错过了什么吗?
【问题讨论】:
-
从这个错误
1> /usr/local/bin/cmake does not exist看来,它似乎找不到 CMake。您是否在 Linux 操作系统上安装了 cmake,如果是,它是否在您的PATH中? (即测试,只需从命令行调用 cmake)。看起来它在定位 CMake 时遇到了问题,而不是实际的 CMake 脚本本身。 -
是的,我已经在我的 Linux 机器上安装了 CMake,它在 PATH 上,尽管我怀疑在 json 文件中提供它的位置是因为它不需要在 PATH 上。
标签: linux cmake visual-studio-2017 cmake-server