diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2014-03-14 08:47:37 -0600 |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2014-03-14 08:48:18 -0600 |
commit | 91fd99b86532dbf35d8c7396654b9beac058c8f3 (patch) | |
tree | 5a1df0250f91360185f5087386a0906e6aa5debb | |
parent | 82a7d54cfe75c399b66c888acfcb5ddb15af547b (diff) | |
download | cmake-91fd99b86532dbf35d8c7396654b9beac058c8f3.tar.gz |
Encoding: Provide option to configure CMake to use UTF-8 encoding.
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 2 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 1 |
5 files changed, 14 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f8301505a..b0793d0284 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,13 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") endmacro() endif() +# option to set the internal encoding of CMake to UTF-8 +option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally (experimental)." OFF) +mark_as_advanced(CMAKE_ENCODING_UTF8) +if(CMAKE_ENCODING_UTF8) + set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) +endif() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 966e0f68c1..9fb8d9a4c7 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -24,6 +24,11 @@ endif() set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) +# ensure Unicode friendly APIs are used on Windows +if(WIN32) + add_definitions(-DUNICODE -D_UNICODE) +endif() + # configure the .h file configure_file( "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 0dd01d8489..4308a4d6fd 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -55,11 +55,6 @@ else() endif() endif() - -if(WIN32 AND KWSYS_ENCODING_DEFAULT_CODEPAGE MATCHES CP_UTF8) - add_definitions(-DKWSYS_CP_UTF8) -endif() - set(SRCS AddCacheEntry.cxx AddCacheEntry.h diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 995929e3bb..e37bd9d0b7 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -79,7 +79,7 @@ int main(int argc, char** argv) QApplication app(argc, argv); -#if defined(KWSYS_CP_UTF8) +#if defined(CMAKE_ENCODING_UTF8) QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForCStrings(utf8_codec); QTextCodec::setCodecForLocale(utf8_codec); diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index c5e95d0caf..2b0280db5a 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -16,4 +16,5 @@ #cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER +#cmakedefine CMAKE_ENCODING_UTF8 #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" |