From e803bf11296d8e7900dafb41e7b1224778d33dc6 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Thu, 19 Nov 2020 21:39:08 -0800 Subject: [PATCH] [vcpkg] fix cmake paths in tags (alternative 2) (#14661) * [vcpkg] fix cmake paths in tags (alternative 2) * fix compile on VS2019 unnecessary and invalid SFINAE'd constructor --- toolsrc/include/vcpkg/base/span.h | 5 ----- toolsrc/src/vcpkg/cmakevars.cpp | 24 ++++++++++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h index 91d94ec473..7748222cfa 100644 --- a/toolsrc/include/vcpkg/base/span.h +++ b/toolsrc/include/vcpkg/base/span.h @@ -32,11 +32,6 @@ namespace vcpkg { } - template::value>> - constexpr Span(std::remove_const_t (&arr)[N]) noexcept : m_ptr(arr), m_count(N) - { - } - template().data()), class = std::enable_if_t, Span>::value>> diff --git a/toolsrc/src/vcpkg/cmakevars.cpp b/toolsrc/src/vcpkg/cmakevars.cpp index 69326fffc5..39a4d18b07 100644 --- a/toolsrc/src/vcpkg/cmakevars.cpp +++ b/toolsrc/src/vcpkg/cmakevars.cpp @@ -85,17 +85,29 @@ namespace vcpkg::CMakeVars { emitted_triplets[spec_abi_setting.first->package_spec.triplet()] = emitted_triplet_id++; } + Strings::append(extraction_file, "macro(vcpkg_triplet_file VCPKG_TRIPLET_ID)\n"); + Strings::append(extraction_file, + "set(_vcpkg_triplet_file_BACKUP_CURRENT_LIST_FILE \"${CMAKE_CURRENT_LIST_FILE}\")\n"); + for (auto& p : emitted_triplets) { - Strings::append(extraction_file, - "if(VCPKG_TRIPLET_ID EQUAL ", - p.second, - ")\n", - fs.read_contents(paths.get_triplet_file_path(p.first), VCPKG_LINE_INFO), - "\nendif()\n"); + auto path_to_triplet = paths.get_triplet_file_path(p.first); + Strings::append(extraction_file, "if(VCPKG_TRIPLET_ID EQUAL ", p.second, ")\n"); + Strings::append( + extraction_file, "set(CMAKE_CURRENT_LIST_FILE \"", fs::generic_u8string(path_to_triplet), "\")\n"); + Strings::append( + extraction_file, + "get_filename_component(CMAKE_CURRENT_LIST_DIR \"${CMAKE_CURRENT_LIST_FILE}\" DIRECTORY)\n"); + Strings::append(extraction_file, fs.read_contents(paths.get_triplet_file_path(p.first), VCPKG_LINE_INFO)); + Strings::append(extraction_file, "\nendif()\n"); } + Strings::append(extraction_file, + "set(CMAKE_CURRENT_LIST_FILE \"${_vcpkg_triplet_file_BACKUP_CURRENT_LIST_FILE}\")\n"); + Strings::append(extraction_file, + "get_filename_component(CMAKE_CURRENT_LIST_DIR \"${CMAKE_CURRENT_LIST_FILE}\" DIRECTORY)\n"); Strings::append(extraction_file, "endmacro()\n"); + for (const auto& spec_abi_setting : spec_abi_settings) { const FullPackageSpec& spec = *spec_abi_setting.first;