Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup vcpkg_configure_cmake.cmake #6792

Merged
merged 4 commits into from
Jul 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 109 additions & 99 deletions scripts/cmake/vcpkg_configure_cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@
##
## ## Parameters
## ### SOURCE_PATH
## Specifies the directory containing the `CMakeLists.txt`. By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
## Specifies the directory containing the `CMakeLists.txt`.
## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
##
## ### PREFER_NINJA
## Indicates that, when available, Vcpkg should use Ninja to perform the build. This should be specified unless the port is known to not work under Ninja.
## Indicates that, when available, Vcpkg should use Ninja to perform the build.
## This should be specified unless the port is known to not work under Ninja.
##
## ### DISABLE_PARALLEL_CONFIGURE
## Disables running the CMake configure step in parallel.
##
## This is needed for libraries which write back into their source directory during configure.
##
## ### GENERATOR
## Specifies the precise generator to use.
##
## This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build. If used for this purpose, it should be set to "NMake Makefiles".
## This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build.
## If used for this purpose, it should be set to "NMake Makefiles".
##
## ### OPTIONS
## Additional options passed to CMake during the configuration.
Expand All @@ -50,31 +52,41 @@
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake)
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake)
function(vcpkg_configure_cmake)
cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
cmake_parse_arguments(_csc
"PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE"
"SOURCE_PATH;GENERATOR"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE"
${ARGN}
)

if(NOT VCPKG_PLATFORM_TOOLSET)
message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap-vcpkg.bat\n")
endif()

if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITEW6432})
else()
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITECTURE})
message(FATAL_ERROR "Vcpkg has been updated with VS2017 support; "
"however, vcpkg.exe must be rebuilt by re-running bootstrap-vcpkg.bat\n")
endif()

if(CMAKE_HOST_WIN32)
set(_PATHSEP ";")
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITEW6432})
else()
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITECTURE})
endif()
else()
set(_PATHSEP ":")
endif()

set(NINJA_CAN_BE_USED ON) # Ninja as generator
set(NINJA_CAN_BE_USED ON) # Ninja as generator
Rastaban marked this conversation as resolved.
Show resolved Hide resolved
set(NINJA_HOST ON) # Ninja as parallel configurator

if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(_TARGETTING_UWP 1)
endif()

if(_csc_HOST_ARCHITECTURE STREQUAL "x86")
# Prebuilt ninja binaries are only provided for x64 hosts
set(NINJA_CAN_BE_USED OFF)
set(NINJA_HOST OFF)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
elseif(_TARGETTING_UWP)
# Ninja and MSBuild have many differences when targetting UWP, so use MSBuild to maximize existing compatibility
set(NINJA_CAN_BE_USED OFF)
endif()
Expand All @@ -83,51 +95,52 @@ function(vcpkg_configure_cmake)
set(GENERATOR ${_csc_GENERATOR})
elseif(_csc_PREFER_NINJA AND NINJA_CAN_BE_USED)
set(GENERATOR "Ninja")
elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE OR (VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE OR (VCPKG_CMAKE_SYSTEM_NAME AND NOT _TARGETTING_UWP))
set(GENERATOR "Ninja")

elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120")
set(GENERATOR "Visual Studio 12 2013")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120")
set(GENERATOR "Visual Studio 12 2013 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120")
set(GENERATOR "Visual Studio 12 2013 ARM")

elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(GENERATOR "Visual Studio 14 2015")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(GENERATOR "Visual Studio 14 2015 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(GENERATOR "Visual Studio 14 2015 ARM")

elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(GENERATOR "Visual Studio 15 2017")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(GENERATOR "Visual Studio 15 2017 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(GENERATOR "Visual Studio 15 2017 ARM")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(GENERATOR "Visual Studio 15 2017")
set(ARCH "ARM64")

elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
set(GENERATOR "Visual Studio 16 2019")
set(ARCH "Win32")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
set(GENERATOR "Visual Studio 16 2019")
set(ARCH "x64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
set(GENERATOR "Visual Studio 16 2019")
set(ARCH "ARM")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
set(GENERATOR "Visual Studio 16 2019")
set(ARCH "ARM64")

else()
if(NOT VCPKG_CMAKE_SYSTEM_NAME)
set(VCPKG_CMAKE_SYSTEM_NAME Windows)
endif()
message(FATAL_ERROR "Unable to determine appropriate generator for: ${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}")
message(FATAL_ERROR "Unable to determine appropriate generator for: "
"${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}")
endif()

# If we use Ninja, make sure it's on PATH
Expand All @@ -142,10 +155,11 @@ function(vcpkg_configure_cmake)

if(DEFINED VCPKG_CMAKE_SYSTEM_NAME)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
if(_TARGETTING_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
set(VCPKG_CMAKE_SYSTEM_VERSION 10.0)
endif()
endif()

if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}")
endif()
Expand All @@ -155,40 +169,37 @@ function(vcpkg_configure_cmake)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF)
else()
message(FATAL_ERROR "Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\". It must be \"static\" or \"dynamic\"")
message(FATAL_ERROR
"Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\". "
"It must be \"static\" or \"dynamic\"")
endif()

if((NOT DEFINED VCPKG_CXX_FLAGS_DEBUG AND NOT DEFINED VCPKG_C_FLAGS_DEBUG) OR
(DEFINED VCPKG_CXX_FLAGS_DEBUG AND DEFINED VCPKG_C_FLAGS_DEBUG))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS_DEBUG and VCPKG_C_FLAGS_DEBUG")
endif()
if((NOT DEFINED VCPKG_CXX_FLAGS_RELEASE AND NOT DEFINED VCPKG_C_FLAGS_RELEASE) OR
(DEFINED VCPKG_CXX_FLAGS_RELEASE AND DEFINED VCPKG_C_FLAGS_RELEASE))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS_RELEASE and VCPKG_C_FLAGS_RELEASE")
endif()
if((NOT DEFINED VCPKG_CXX_FLAGS AND NOT DEFINED VCPKG_C_FLAGS) OR
(DEFINED VCPKG_CXX_FLAGS AND DEFINED VCPKG_C_FLAGS))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS and VCPKG_C_FLAGS")
endif()
macro(check_both_vars_are_set var1 var2)
if((NOT DEFINED ${var1} OR NOT DEFINED ${var2}) AND (DEFINED ${var1} OR DEFINED ${var2}))
message(FATAL_ERROR "Both ${var1} and ${var2} must be set.")
endif()
endmacro()

if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME)
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/windows.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/linux.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/android.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/osx.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/freebsd.cmake")
check_both_vars_are_set(VCPKG_CXX_FLAGS_DEBUG VCPKG_C_FLAGS_DEBUG)
check_both_vars_are_set(VCPKG_CXX_FLAGS_RELEASE VCPKG_C_FLAGS_RELEASE)
check_both_vars_are_set(VCPKG_CXX_FLAGS VCPKG_C_FLAGS)

if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
if(NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR _TARGETTING_UWP)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/windows.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/linux.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/android.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/osx.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/freebsd.cmake")
endif()
endif()

list(APPEND _csc_OPTIONS
"-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}"
"-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
"-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
Expand Down Expand Up @@ -218,15 +229,11 @@ function(vcpkg_configure_cmake)
endif()

# Sets configuration variables for macOS builds
if(DEFINED VCPKG_INSTALL_NAME_DIR)
list(APPEND _csc_OPTIONS "-DCMAKE_INSTALL_NAME_DIR=${VCPKG_INSTALL_NAME_DIR}")
endif()
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
list(APPEND _csc_OPTIONS "-DCMAKE_OSX_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
endif()
if(DEFINED VCPKG_OSX_SYSROOT)
list(APPEND _csc_OPTIONS "-DCMAKE_OSX_SYSROOT=${VCPKG_OSX_SYSROOT}")
endif()
foreach(config_var INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT)
if(DEFINED VCPKG_${config_var})
list(APPEND _csc_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}")
endif()
endforeach()

set(rel_command
${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}"
Expand All @@ -239,31 +246,34 @@ function(vcpkg_configure_cmake)
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug)

if(NINJA_HOST AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT _csc_DISABLE_PARALLEL_CONFIGURE)
if(NINJA_HOST AND CMAKE_HOST_WIN32 AND NOT _csc_DISABLE_PARALLEL_CONFIGURE)

vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
if(NOT EXISTS NINJA)
vcpkg_find_acquire_program(NINJA)
Rastaban marked this conversation as resolved.
Show resolved Hide resolved
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
endif()

#parallelize the configure step
set(_contents
"rule CreateProcess\n command = $process\n\n"
)

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(rel_line "build ../CMakeCache.txt: CreateProcess\n process = cmd /c \"cd .. &&")
foreach(arg ${rel_command})
set(rel_line "${rel_line} \"${arg}\"")
macro(_build_cmakecache whereat build_type)
set(${build_type}_line "build ${whereat}/CMakeCache.txt: CreateProcess\n process = cmd /c \"cd ${whereat} &&")
foreach(arg ${${build_type}_command})
Rastaban marked this conversation as resolved.
Show resolved Hide resolved
set(${build_type}_line "${${build_type}_line} \"${arg}\"")
endforeach()
set(_contents "${_contents}${rel_line}\"\n\n")
endif()
set(_contents "${_contents}${${build_type}_line}\"\n\n")
endmacro()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(dbg_line "build ../../${TARGET_TRIPLET}-dbg/CMakeCache.txt: CreateProcess\n process = cmd /c \"cd ../../${TARGET_TRIPLET}-dbg &&")
foreach(arg ${dbg_command})
set(dbg_line "${dbg_line} \"${arg}\"")
endforeach()
set(_contents "${_contents}${dbg_line}\"\n\n")
if(NOT DEFINED VCPKG_BUILD_TYPE)
_build_cmakecache(".." "rel")
_build_cmakecache("../../${TARGET_TRIPLET}-dbg" "dbg")
elseif(VCPKG_BUILD_TYPE STREQUAL "release")
_build_cmakecache(".." "rel")
elseif(VCPKG_BUILD_TYPE STREQUAL "debug")
_build_cmakecache("../../${TARGET_TRIPLET}-dbg" "dbg")
endif()

file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure)
Expand All @@ -276,25 +286,25 @@ function(vcpkg_configure_cmake)
LOGNAME config-${TARGET_TRIPLET}
)
else()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
macro(_configure_target_triplet build_type)
message(STATUS "Configuring ${TARGET_TRIPLET}-${build_type}")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${build_type})
vcpkg_execute_required_process(
COMMAND ${dbg_command}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME config-${TARGET_TRIPLET}-dbg
COMMAND ${${build_type}_command}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${build_type}
LOGNAME config-${TARGET_TRIPLET}-${build_type}
)
endif()
endmacro()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
vcpkg_execute_required_process(
COMMAND ${rel_command}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME config-${TARGET_TRIPLET}-rel
)
if(NOT DEFINED VCPKG_BUILD_TYPE)
_configure_target_triplet("dbg")
_configure_target_triplet("rel")
elseif(VCPKG_BUILD_TYPE STREQUAL "debug")
_configure_target_triplet("dbg")
elseif(VCPKG_BUILD_TYPE STREQUAL "release")
_configure_target_triplet("rel")
endif()

endif()

set(_VCPKG_CMAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE)
Expand Down