What I need:
I want to use cmake tool to add x86-windows-static
in Triplet option and Debug
in Vcpkg Configuration.
Look the screenshots below,
![vs screenshot 1](https://i.stack.imgur.com/v75a8.png)
↓
![vs screenshot 2](https://i.stack.imgur.com/o5UXf.png)
What I have tried:
I read some docs to changed these vars, but failed.
My part code in CMakeLists,
...
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_GENERATOR_PLATFORM Win32)
set(CMAKE_GENERATOR_TOOLSET "host=x86" CACHE STRING "Platform Toolset" FORCE)
#set vcpkg
set(VCPKG_ROOT_DIR "C:/Users/xxx/vcpkg" CACHE PATH "set vcpkg path")
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/buildsystems/vcpkg.cmake")
message(VCPKG_ROOT = "${CMAKE_TOOLCHAIN_FILE}")
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Empty)
set(VCPKG_TARGET_TRIPLET "x86-windows-static")
endif()
project(my_project)
...
Output:
$ cmake -B build
VCPKG_ROOT=C:/Users/xxx/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/my_project/build
Reopen .sln project, no happended in the Triplet option and Vcpkg Configuration,they are still empty.
BTW, I can use VS_GLOBAL_VcpkgEnabled
to change Use Vcpkg
`set_target_properties(my_project PROPERTIES VS_GLOBAL_VcpkgEnabled true)
`
![vs screenshot 3](https://i.stack.imgur.com/glwUj.png)
But I cannot change the other vcpkg options.
My question:
Can I modify the relevant variable values in CMakeLists to change the vcpkg options in VS project?
If not, is there any other way?
Thanks in advance!