]> granicus.if.org Git - libexpat/commitdiff
CMake: Fix use of XML_UNICODE and XML_UNICODE_WCHAR_T
authorSebastian Pipping <sebastian@pipping.org>
Mon, 2 Sep 2019 21:48:25 +0000 (23:48 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 2 Sep 2019 22:36:36 +0000 (00:36 +0200)
C/C++ code is not ready to get those from expat_config.h, yet.

expat/CMakeLists.txt
expat/Changes
expat/expat_config.h.cmake

index 64e6e36ba093a5e4a8524f7764de86d7acde334b..16240e2a024ecf24d5559904bd5e95c07b583f55 100644 (file)
@@ -113,6 +113,14 @@ if(EXPAT_BUILD_TOOLS AND (EXPAT_UNICODE AND NOT EXPAT_UNICODE_WCHAR_T))
     message(SEND_ERROR "The xmlwf tool can not be built with option EXPAT_UNICODE_WCHAR_T=OFF and EXPAT_UNICODE=ON. Either set EXPAT_UNICODE_WCHAR_T=ON or EXPAT_BUILD_TOOLS=OFF.")
 endif()
 
+if(EXPAT_UNICODE)
+    if(EXPAT_UNICODE_WCHAR_T)
+        add_definitions(-DXML_UNICODE_WCHAR_T)  # for wchar_t
+    else()
+        add_definitions(-DXML_UNICODE)          # for unsigned short
+    endif()
+endif()
+
 include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake)
 
 macro(evaluate_detection_results use_ref have_ref thing_lower thing_title)
@@ -135,8 +143,6 @@ _expat_copy_bool_int(EXPAT_DTD              XML_DTD)
 _expat_copy_bool_int(EXPAT_LARGE_SIZE       XML_LARGE_SIZE)
 _expat_copy_bool_int(EXPAT_MIN_SIZE         XML_MIN_SIZE)
 _expat_copy_bool_int(EXPAT_NS               XML_NS)
-_expat_copy_bool_int(EXPAT_UNICODE          XML_UNICODE)
-_expat_copy_bool_int(EXPAT_UNICODE_WCHAR_T  XML_UNICODE_WCHAR_T)
 if(NOT WIN32)
     _expat_copy_bool_int(EXPAT_DEV_URANDOM  XML_DEV_URANDOM)
 endif()
index c29d69fbafdaca05b7617edd2ebc0cea92ac34d8..84a528a8bab5faacc0c0ab366dae8ee49f35400c 100644 (file)
@@ -56,6 +56,8 @@ Release x.x.x xxx xxx xx xxxx
                   CMake: Now produces a summary of applied configuration
                   CMake: Require C++ compiler only when tests are enabled
             #265  CMake: Fix linking with MinGW
+            #330  CMake: Fix compilation for 16bit character types,
+                    i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON)
             #330  CMake: Add full support for MinGW; to enable, use
                     -DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake
             #330  CMake: Port "make run-xmltest" from GNU Autotools to CMake
index bb8c86cd6c3cdad13c7223ade5680105a1541426..173fed168c11c30461c0d5b004691107f09ad487 100644 (file)
 /* Define to make XML Namespaces functionality available. */
 #cmakedefine XML_NS
 
-/* Define to use UTF-16 chars (two bytes). */
-#cmakedefine XML_UNICODE
-
-/* Define to use wchar_t as UTF-16 char type instead of unsigned short. */
-#cmakedefine XML_UNICODE_WCHAR_T
-
 /* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
 #ifdef _MSC_VER
 #  define __func__ __FUNCTION__