From 44da6b78fc47d2cc0ea212cc5a9a15cb21f3d4aa Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 25 May 2021 00:47:44 +0200 Subject: [PATCH] [vcpkg_configure_make] Don't create empty elements in include path vars (#17970) --- scripts/cmake/vcpkg_configure_make.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index c5b2e59127e..2294bf8078f 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -514,11 +514,18 @@ function(vcpkg_configure_make) endif() # Setup include environment (since these are buildtype independent restoring them is unnecessary) + macro(prepend_include_path var) + if("${${var}_BACKUP}" STREQUAL "") + set(ENV{${var}} "${_VCPKG_INSTALLED}/include") + else() + set(ENV{${var}} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${${var}_BACKUP}") + endif() + endmacro() # Used by CL - set(ENV{INCLUDE} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_BACKUP}") + prepend_include_path(INCLUDE) # Used by GCC - set(ENV{C_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${C_INCLUDE_PATH_BACKUP}") - set(ENV{CPLUS_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${CPLUS_INCLUDE_PATH_BACKUP}") + prepend_include_path(C_INCLUDE_PATH) + prepend_include_path(CPLUS_INCLUDE_PATH) # Flags should be set in the toolchain instead (Setting this up correctly requires a function named vcpkg_determined_cmake_compiler_flags which can also be used to setup CC and CXX etc.) if(VCPKG_TARGET_IS_WINDOWS)