[vcpkg] Fix regressions in WSL build.
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -3,10 +3,12 @@ project(vcpkg CXX)
add_compile_options(-std=c++1z)
-if(CMAKE_COMPILER_IS_GNUXX)
+if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(GCC 1)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
set(CLANG 1)
+else()
+ message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)

MODIFY
include/vcpkg/base/optional.h
include/vcpkg/base/optional.h
@@ -53,10 +53,8 @@ namespace vcpkg
// Constructors are intentionally implicit
constexpr Optional(NullOpt) {}
- Optional(const T& t) : m_base(t) {}
-
- template<class = std::enable_if_t<!std::is_reference<T>::value>>
- Optional(T&& t) : m_base(std::move(t))
+ template<class U>
+ Optional(U&& t) : m_base(std::forward<U>(t))
{
}

MODIFY
src/vcpkg/base/chrono.cpp
src/vcpkg/base/chrono.cpp
@@ -92,7 +92,13 @@ namespace vcpkg::Chrono
Optional<CTime> CTime::parse(CStringView str)
{
CTime ret;
- auto assigned = sscanf_s(str.c_str(),
+ auto assigned =
+#if defined(_WIN32)
+ sscanf_s
+#else
+ sscanf
+#endif
+ (str.c_str(),
"%d-%d-%dT%d:%d:%d.",
&ret.m_tm.tm_year,
&ret.m_tm.tm_mon,

RENAME
src/commands.upgrade.cpp
src/vcpkg/commands.upgrade.cpp
MODIFY
src/vcpkg/userconfig.cpp
src/vcpkg/userconfig.cpp
#include <vcpkg/paragraphs.h>
#include <vcpkg/userconfig.h>
+#if defined(_WIN32)
namespace
{
static vcpkg::Lazy<fs::path> s_localappdata;
@@ -24,13 +25,14 @@ namespace
});
}
}
+#endif
namespace vcpkg
{
UserConfig UserConfig::try_read_data(const Files::Filesystem& fs)
{
UserConfig ret;
-
+#if defined(_WIN32)
try
{
auto maybe_pghs = Paragraphs::get_paragraphs(fs, get_localappdata() / "vcpkg" / "config");
@@ -56,12 +58,14 @@ namespace vcpkg
catch (...)
{
}
+#endif
return ret;
}
void UserConfig::try_write_data(Files::Filesystem& fs) const
{
+#if defined(_WIN32)
try
{
std::error_code ec;
@@ -79,5 +83,6 @@ namespace vcpkg
catch (...)
{
}
+#endif
}
}

MODIFY
vcpkglib/vcpkglib.vcxproj
vcpkglib/vcpkglib.vcxproj
<ClInclude Include="..\include\vcpkg\versiont.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\commands.upgrade.cpp" />
<ClCompile Include="..\src\pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<ClCompile Include="..\src\vcpkg\commands.owns.cpp" />
<ClCompile Include="..\src\vcpkg\commands.portsdiff.cpp" />
<ClCompile Include="..\src\vcpkg\commands.search.cpp" />
+ <ClCompile Include="..\src\vcpkg\commands.upgrade.cpp" />
<ClCompile Include="..\src\vcpkg\commands.version.cpp" />
<ClCompile Include="..\src\vcpkg\dependencies.cpp" />
<ClCompile Include="..\src\vcpkg\export.cpp" />

MODIFY
vcpkglib/vcpkglib.vcxproj.filters
vcpkglib/vcpkglib.vcxproj.filters
<ClCompile Include="..\src\vcpkg\userconfig.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
- <ClCompile Include="..\src\commands.upgrade.cpp">
+ <ClCompile Include="..\src\vcpkg\commands.upgrade.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
</ItemGroup>

[vcpkg] Fix regressions in WSL build.