Use cwstring_view in CMakeVariable
MODIFY
include/vcpkglib.h
include/vcpkglib.h
@@ -24,10 +24,10 @@ namespace vcpkg
struct CMakeVariable
{
- CMakeVariable(const std::wstring& varname, const wchar_t* varvalue);
- CMakeVariable(const std::wstring& varname, const std::string& varvalue);
- CMakeVariable(const std::wstring& varname, const std::wstring& varvalue);
- CMakeVariable(const std::wstring& varname, const fs::path& path);
+ CMakeVariable(const cwstring_view varname, const wchar_t* varvalue);
+ CMakeVariable(const cwstring_view varname, const std::string& varvalue);
+ CMakeVariable(const cwstring_view varname, const std::wstring& varvalue);
+ CMakeVariable(const cwstring_view varname, const fs::path& path);
std::wstring s;
};

MODIFY
src/vcpkglib.cpp
src/vcpkglib.cpp
@@ -215,10 +215,10 @@ namespace vcpkg
return installed_files;
}
- CMakeVariable::CMakeVariable(const std::wstring& varname, const wchar_t* varvalue) : s(Strings::wformat(LR"("-D%s=%s")", varname, varvalue)) { }
- CMakeVariable::CMakeVariable(const std::wstring& varname, const std::string& varvalue) : CMakeVariable(varname, Strings::utf8_to_utf16(varvalue).c_str()) { }
- CMakeVariable::CMakeVariable(const std::wstring& varname, const std::wstring& varvalue) : CMakeVariable(varname, varvalue.c_str()) {}
- CMakeVariable::CMakeVariable(const std::wstring& varname, const fs::path& path) : CMakeVariable(varname, path.generic_wstring()) {}
+ CMakeVariable::CMakeVariable(const cwstring_view varname, const wchar_t* varvalue) : s(Strings::wformat(LR"("-D%s=%s")", varname, varvalue)) { }
+ CMakeVariable::CMakeVariable(const cwstring_view varname, const std::string& varvalue) : CMakeVariable(varname, Strings::utf8_to_utf16(varvalue).c_str()) { }
+ CMakeVariable::CMakeVariable(const cwstring_view varname, const std::wstring& varvalue) : CMakeVariable(varname, varvalue.c_str()) {}
+ CMakeVariable::CMakeVariable(const cwstring_view varname, const fs::path& path) : CMakeVariable(varname, path.generic_wstring()) {}
std::wstring make_cmake_cmd(const fs::path& cmake_exe, const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables)
{

Use cwstring_view in CMakeVariable