【发布时间】:2018-01-27 01:04:08
【问题描述】:
使用 CMake support in Visual Studio,我如何运行 INSTALL 构建?
在顶部工具栏中的 CMake 菜单中,我没有看到任何运行 INSTALL 项目的选项。
编辑:vre 建议的最低设置有效,安装选项出现在工具栏菜单中:
-
CMakeLists.txt
# 3.9.2 is the current version the newest VS is using cmake_minimum_required(VERSION 3.9.2) project(test2017) add_executable(hello hello.cpp) install(TARGETS hello DESTINATION hello/bin) hello.cpp
但是当我将hello.cpp 移动到子文件夹时,该选项消失了:
-
CMakeLists.txt
cmake_minimum_required(VERSION 3.9.2) project(test2017) add_subdirectory("src") -
src/CMakeLists.txt
add_executable(hello hello.cpp) install(TARGETS hello DESTINATION "hello/bin") src/hello.cpp
【问题讨论】:
-
可以添加CMakeSettings.json和CMakeLists.txt的内容吗?我尝试使用带有以下 CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12) project(test2017) add_executable(hello hello.cpp) install(TARGETS hello DESTINATION hello/bin)的 VS2017 15.5.5,安装选项显示在工具栏菜单和 CMakeLists.txt 的上下文菜单中。 -
也许 VS2017 15.2 中的这个 bug (developercommunity.visualstudio.com/content/problem/46744/…) 对你有影响?
-
@vre 我按照您的建议添加了一个 CMakeLists 示例。当我将 cpp 文件移动到另一个文件夹时,安装选项消失了。
标签: visual-studio cmake visual-studio-2017