aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2020-11-19 21:39:08 -0800
committerGitHub <noreply@github.com>2020-11-19 21:39:08 -0800
commite803bf11296d8e7900dafb41e7b1224778d33dc6 (patch)
tree7065d38889979737c11e3cc43de58beb4267439c
parent88de49b139c620835e841c58b9eae486b45d1bd3 (diff)
downloadvcpkg-e803bf11296d8e7900dafb41e7b1224778d33dc6.tar.gz
vcpkg-e803bf11296d8e7900dafb41e7b1224778d33dc6.zip
[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
-rw-r--r--toolsrc/include/vcpkg/base/span.h5
-rw-r--r--toolsrc/src/vcpkg/cmakevars.cpp24
2 files changed, 18 insertions, 11 deletions
diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h
index 91d94ec47..7748222cf 100644
--- a/toolsrc/include/vcpkg/base/span.h
+++ b/toolsrc/include/vcpkg/base/span.h
@@ -32,11 +32,6 @@ namespace vcpkg
{
}
- template<size_t N, class = std::enable_if_t<std::is_const<T>::value>>
- constexpr Span(std::remove_const_t<T> (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
- {
- }
-
template<class Range,
class = decltype(std::declval<Range>().data()),
class = std::enable_if_t<!std::is_same<std::decay_t<Range>, Span>::value>>
diff --git a/toolsrc/src/vcpkg/cmakevars.cpp b/toolsrc/src/vcpkg/cmakevars.cpp
index 69326fffc..39a4d18b0 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;