diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2019-11-22 09:47:40 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-22 09:47:40 -0800 |
| commit | 45f4b820e5743b89bca3508ba2028cdd5d8bbd17 (patch) | |
| tree | f874a8c4a7392309bdbb86447288597ec0a4a281 /scripts/buildsystems | |
| parent | 62d67d3bf8eeff1afa8009041fd08b8822676b7b (diff) | |
| parent | 8831e8f25f1ff6546ee4a5291b91d599421637b3 (diff) | |
| download | vcpkg-45f4b820e5743b89bca3508ba2028cdd5d8bbd17.tar.gz vcpkg-45f4b820e5743b89bca3508ba2028cdd5d8bbd17.zip | |
Merge branch 'master' into vcpkg_nuget
Diffstat (limited to 'scripts/buildsystems')
| -rw-r--r-- | scripts/buildsystems/msbuild/applocal.ps1 | 2 | ||||
| -rw-r--r-- | scripts/buildsystems/vcpkg.cmake | 51 |
2 files changed, 30 insertions, 23 deletions
diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index 2fdd9fdb4..ab51dc9be 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -29,7 +29,7 @@ function deployBinary([string]$targetBinaryDir, [string]$SourceDir, [string]$tar Copy-Item "$SourceDir\$targetBinaryName" $targetBinaryDir } if ($copiedFilesLog) { Add-Content $copiedFilesLog "$targetBinaryDir\$targetBinaryName" -Encoding UTF8 } - if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" } + if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" -Encoding Unicode } } diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index f657e2710..ed9bcbc69 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,10 +1,17 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) -# This is a backport of CMAKE_TRY_COMPILE_PLATFORM_VARIABLES to cmake 3.0 -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if( _CMAKE_IN_TRY_COMPILE ) - include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) +# Determine whether the toolchain is loaded during a try-compile configuration +get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) + +if (${CMAKE_VERSION} VERSION_LESS "3.6.0") + set(_CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES ON) +else() + set(_CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES OFF) +endif() + +if(_CMAKE_IN_TRY_COMPILE AND _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES) + include("${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL) endif() if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) @@ -38,17 +45,7 @@ else() elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$") - if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Xx]86$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Mm][Dd]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm64) - else() - - endif() + set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() find_program(_VCPKG_CL cl) if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") @@ -274,13 +271,23 @@ set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}) +# Propogate these values to try-compile configurations so the triplet and toolchain load if(NOT _CMAKE_IN_TRY_COMPILE) - file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file) - file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir) - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake" - "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n" - "set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n" - "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n" - "set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n" + if(_CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES) + file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file) + file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir) + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake" + "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n" + "set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n" + "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n" + "set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n" ) + else() + set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + VCPKG_TARGET_TRIPLET + VCPKG_APPLOCAL_DEPS + VCPKG_CHAINLOAD_TOOLCHAIN_FILE + _VCPKG_ROOT_DIR + ) + endif() endif() |
