Failed to run MSBuild command to get the value of VCTargetsPath
I am getting this error while using cmake to generate a visual studio project. For context, I am attempting to do some exercises at Exercism (requires sign up). I have installed v141 in VS (see screenshot below). What seems to be the problem?
OS: Windows 10
CMake: 3.12.4
Boost: 1.55.0
Visual Studio Enterprise 2017 15.8.4
CMakeLists.txt
# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)
# Name the project after the exercise
project(${exercise} CXX)
# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})
# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})
# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})
Error
C:UsershurrjaeExercismcpphello-world>cmake -DBOOST_INCLUDEDIR:PATH="C:Program FilesBoostboost_1_55_0"
CMake Error at CMakeLists.txt:8 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20/11/2018 9:50:14 PM.
Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" on node 1 (default targets).
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
Done Building Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default target) (1) ->
(PlatformPrepareForBuild target) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.18
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/hurrjae/Exercism/cpp/hello-world/CMakeFiles/CMakeOutput.log".
CMakeOutput.log
The system is: Windows - 10.0.17134 - AMD64
windows visual-c++ cmake msbuild
add a comment |
I am getting this error while using cmake to generate a visual studio project. For context, I am attempting to do some exercises at Exercism (requires sign up). I have installed v141 in VS (see screenshot below). What seems to be the problem?
OS: Windows 10
CMake: 3.12.4
Boost: 1.55.0
Visual Studio Enterprise 2017 15.8.4
CMakeLists.txt
# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)
# Name the project after the exercise
project(${exercise} CXX)
# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})
# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})
# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})
Error
C:UsershurrjaeExercismcpphello-world>cmake -DBOOST_INCLUDEDIR:PATH="C:Program FilesBoostboost_1_55_0"
CMake Error at CMakeLists.txt:8 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20/11/2018 9:50:14 PM.
Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" on node 1 (default targets).
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
Done Building Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default target) (1) ->
(PlatformPrepareForBuild target) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.18
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/hurrjae/Exercism/cpp/hello-world/CMakeFiles/CMakeOutput.log".
CMakeOutput.log
The system is: Windows - 10.0.17134 - AMD64
windows visual-c++ cmake msbuild
add a comment |
I am getting this error while using cmake to generate a visual studio project. For context, I am attempting to do some exercises at Exercism (requires sign up). I have installed v141 in VS (see screenshot below). What seems to be the problem?
OS: Windows 10
CMake: 3.12.4
Boost: 1.55.0
Visual Studio Enterprise 2017 15.8.4
CMakeLists.txt
# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)
# Name the project after the exercise
project(${exercise} CXX)
# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})
# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})
# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})
Error
C:UsershurrjaeExercismcpphello-world>cmake -DBOOST_INCLUDEDIR:PATH="C:Program FilesBoostboost_1_55_0"
CMake Error at CMakeLists.txt:8 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20/11/2018 9:50:14 PM.
Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" on node 1 (default targets).
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
Done Building Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default target) (1) ->
(PlatformPrepareForBuild target) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.18
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/hurrjae/Exercism/cpp/hello-world/CMakeFiles/CMakeOutput.log".
CMakeOutput.log
The system is: Windows - 10.0.17134 - AMD64
windows visual-c++ cmake msbuild
I am getting this error while using cmake to generate a visual studio project. For context, I am attempting to do some exercises at Exercism (requires sign up). I have installed v141 in VS (see screenshot below). What seems to be the problem?
OS: Windows 10
CMake: 3.12.4
Boost: 1.55.0
Visual Studio Enterprise 2017 15.8.4
CMakeLists.txt
# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)
# Name the project after the exercise
project(${exercise} CXX)
# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})
# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})
# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})
Error
C:UsershurrjaeExercismcpphello-world>cmake -DBOOST_INCLUDEDIR:PATH="C:Program FilesBoostboost_1_55_0"
CMake Error at CMakeLists.txt:8 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20/11/2018 9:50:14 PM.
Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" on node 1 (default targets).
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
Done Building Project "C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj" (default target) (1) ->
(PlatformPrepareForBuild target) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:UsershurrjaeExercismcpphello-worldCMakeFiles3.12.4VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.18
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/hurrjae/Exercism/cpp/hello-world/CMakeFiles/CMakeOutput.log".
CMakeOutput.log
The system is: Windows - 10.0.17134 - AMD64
windows visual-c++ cmake msbuild
windows visual-c++ cmake msbuild
asked Nov 20 '18 at 9:00
iH8WorkingWith.NetGraphicsiH8WorkingWith.NetGraphics
4418
4418
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389448%2ffailed-to-run-msbuild-command-to-get-the-value-of-vctargetspath%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389448%2ffailed-to-run-msbuild-command-to-get-the-value-of-vctargetspath%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown