From 31608174fa4ab844583a01c12f1fd4033a079846 Mon Sep 17 00:00:00 2001 From: Be Date: Thu, 28 Jan 2021 13:43:14 -0800 Subject: [PATCH] set CMake policy CMP0087 for X_VCPKG_APPLOCAL_DEPS_INSTALL (#15874) Without this, X_VCPKG_APPLOCAL_DEPS_INSTALL does not work and CMake prints this warning at the configure step: CMake Warning (dev) in CMakeLists.txt: Policy CMP0087 is not set: Install CODE|SCRIPT allow the use of generator expressions. Run "cmake --help-policy CMP0087" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it. https://cmake.org/cmake/help/latest/policy/CMP0087.html --- scripts/buildsystems/vcpkg.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 2969209399..f4fa8a64f8 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -529,6 +529,10 @@ function(x_vcpkg_install_local_dependencies) foreach(TARGET IN LISTS __VCPKG_APPINSTALL_TARGETS) get_target_property(TARGETTYPE ${TARGET} TYPE) if(NOT TARGETTYPE STREQUAL "INTERFACE_LIBRARY") + # Install CODE|SCRIPT allow the use of generator expressions + if(POLICY CMP0087) + cmake_policy(SET CMP0087 NEW) + endif() install(CODE "message(\"-- Installing app dependencies for ${TARGET}...\") execute_process(COMMAND \"${_VCPKG_POWERSHELL_PATH}\" -noprofile -executionpolicy Bypass -file \"${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1\" -targetBinary \"\${CMAKE_INSTALL_PREFIX}/${__VCPKG_APPINSTALL_DESTINATION}/$\"