With CMake support in Visual Studio, how can I run the INSTALL build?
From the CMake menu in the top toolbar, I don't see any selection to run the INSTALL project.
EDIT: The minimum settings suggested by vre worked, the INSTALL option showed up in the toolbar menu:
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
But when I moved hello.cpp
to a subfolder, the option was gone:
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
The latest version of CMake tools is now available for download in the VS Code Marketplace or using the . vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.
Run cmake-gui.exe, which should be in your Start menu under Program Files, there may also be a shortcut on your desktop, or if you built from source, it will be in the build directory. A GUI will appear similar to what is shown below. The top two entries are the source code and binary directories.
On the Visual Studio main menu, choose File > Open > CMake. Navigate to the CMakeLists. txt file in the root of the bullet3 repo you just downloaded. As soon as you open the folder, your folder structure becomes visible in the Solution Explorer.
It seems there is a bug when using subfolders and still hasn't been fixed in the current VS 15.5.5.
A workaround is adding an install
argument to buildCommandArgs
inside the CMakeSettings.json
file. Example:
{
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v install",
"ctestCommandArgs": ""
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With