diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.cxx | 41 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.h | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 2 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 1 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 8 |
8 files changed, 8 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bc4b4e..a5702e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,12 +66,8 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake) endif() -# option to set the internal encoding of CMake to UTF-8 -option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally." ON) -mark_as_advanced(CMAKE_ENCODING_UTF8) -if(CMAKE_ENCODING_UTF8) - set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) -endif() +# set the internal encoding of CMake to UTF-8 +set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) # option to use COMPONENT with install command option(CMake_INSTALL_COMPONENTS "Using components when installing" OFF) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 5320449..4c8abd9 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -410,8 +410,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, std::ostringstream tmp; tmp << name << "=\"" << value << '"'; - source.AddProcessingInstruction( - "define", cmWIXSourceWriter::CMakeEncodingToUtf8(tmp.str())); + source.AddProcessingInstruction("define", tmp.str()); } bool cmCPackWIXGenerator::CreateWiXSourceFiles() diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index a8b0d7c..b434334 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -117,9 +117,7 @@ void cmWIXSourceWriter::AddProcessingInstruction(std::string const& target, void cmWIXSourceWriter::AddAttribute(std::string const& key, std::string const& value) { - std::string utf8 = CMakeEncodingToUtf8(value); - - File << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"'; + File << " " << key << "=\"" << EscapeAttributeValue(value) << '"'; } void cmWIXSourceWriter::AddAttributeUnlessEmpty(std::string const& key, @@ -130,43 +128,6 @@ void cmWIXSourceWriter::AddAttributeUnlessEmpty(std::string const& key, } } -std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) -{ -#ifdef CMAKE_ENCODING_UTF8 - return value; -#else - if (value.empty()) { - return std::string(); - } - - int characterCount = MultiByteToWideChar( - CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), 0, 0); - - if (characterCount == 0) { - return std::string(); - } - - std::vector<wchar_t> utf16(characterCount); - - MultiByteToWideChar(CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), - &utf16[0], static_cast<int>(utf16.size())); - - int utf8ByteCount = WideCharToMultiByte( - CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), 0, 0, 0, 0); - - if (utf8ByteCount == 0) { - return std::string(); - } - - std::vector<char> utf8(utf8ByteCount); - - WideCharToMultiByte(CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), - &utf8[0], static_cast<int>(utf8.size()), 0, 0); - - return std::string(&utf8[0], utf8.size()); -#endif -} - std::string cmWIXSourceWriter::CreateGuidFromComponentId( std::string const& componentId) { diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index b5c06ab..45aefe5 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -50,8 +50,6 @@ public: std::string CreateGuidFromComponentId(std::string const& componentId); - static std::string CMakeEncodingToUtf8(std::string const& value); - protected: cmCPackLog* Logger; diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index fad8075..9038469 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -95,10 +95,8 @@ int main(int argc, char** argv) setlocale(LC_NUMERIC, "C"); -#if defined(CMAKE_ENCODING_UTF8) QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForLocale(utf8_codec); -#endif #if QT_VERSION < 0x050000 // clean out standard Qt paths for plugins, which we don't use anyway diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 057c6c0..26f1df2 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -20,7 +20,6 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_USE_LIBUV -#cmakedefine CMAKE_ENCODING_UTF8 #cmakedefine CMake_HAVE_CXX_AUTO_PTR #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE #cmakedefine CMake_HAVE_CXX_NULLPTR diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ac76191..1bade57 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -59,7 +59,7 @@ static mode_t mode_setuid = S_ISUID; static mode_t mode_setgid = S_ISGID; #endif -#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) // libcurl doesn't support file:// urls for unicode filenames on Windows. // Convert string from UTF-8 to ACP if this is a file:// URL. static std::string fix_file_url_windows(const std::string& url) @@ -2642,7 +2642,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } -#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) url = fix_file_url_windows(url); #endif @@ -2902,7 +2902,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) unsigned long file_size = cmsys::SystemTools::FileLength(filename); -#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) url = fix_file_url_windows(url); #endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 773f8a0..c60a1ff 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -731,11 +731,5 @@ bool cmGlobalVisualStudio7Generator::IsDependedOn( std::string cmGlobalVisualStudio7Generator::Encoding() { - std::ostringstream encoding; -#ifdef CMAKE_ENCODING_UTF8 - encoding << "UTF-8"; -#else - encoding << "Windows-1252"; -#endif - return encoding.str(); + return "UTF-8"; } |