Windows: Use wide-character system APIs

Make CMake compile with -DUNICODE.  Make it possible for the 8 bit
encoding to eventually be UTF-8 instead ANSI.
This commit is contained in:
Clinton Stimpson
2013-12-04 22:17:24 -07:00
committed by Brad King
parent ce598cc838
commit 0b9906c2fb
9 changed files with 107 additions and 78 deletions

View File

@@ -23,6 +23,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
#include <rpc.h> // for GUID generation
@@ -954,11 +955,12 @@ std::string cmCPackWIXGenerator::GenerateGUID()
UUID guid;
UuidCreate(&guid);
unsigned char *tmp = 0;
UuidToString(&guid, &tmp);
unsigned short *tmp = 0;
UuidToStringW(&guid, &tmp);
std::string result(reinterpret_cast<char*>(tmp));
RpcStringFree(&tmp);
std::string result =
cmsys::Encoding::ToNarrow(reinterpret_cast<wchar_t*>(tmp));
RpcStringFreeW(&tmp);
return cmSystemTools::UpperCase(result);
}