[vcpkg] fix cmake paths in tags (alternative 2)
* [vcpkg] fix cmake paths in tags (alternative 2)
* fix compile on VS2019
unnecessary and invalid SFINAE'd constructor
MODIFY
include/vcpkg/base/span.h
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>>

MODIFY
src/vcpkg/cmakevars.cpp
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;

[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