cmake --build ignores MAP_IMPORTED_CONFIG

Viewed 126

I'm using windows 10, cmake 3.17 and Visual Studio 2015 and I'm trying to include a vcxproj into my CMake project. My CMake has two config Debug and RelWithDebInfo. My vcxproj in the other hand has Debug and Release. With the help of the MAP_IMPORTED_CONFIG_RELWITHDEBINFO properties, I managed to map RelWithDebInfo with Release and it works perfectly when I'm using visual studio on the generated Solution. But the issue comes when I'm using cmake --build command. When I do that, I've got the following error error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') because the build try to build my vcxproj with RelWithDebInfo config which do not exist. The following code is what I use

cmake_minimum_required(VERSION 3.17)
project(add_vcxproj)
include_external_msproject(project1
    ${CMAKE_SOURCE_DIR}/Project1/Project1/Project1.vcxproj
)
set_target_properties(project1 PROPERTIES
      MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
      )

I do not understand why my project try to use RelWithDebInfo instead of Release. Do you guys have an idea on how to force Release for Project1 with cmake --build command? Thanks :)

0 Answers
Related