Author: rleigh
Date: Tue Jan 30 20:01:49 2018
New Revision: 1822690
URL: http://svn.apache.org/viewvc?rev=1822690&view=rev
Log:
cmake: Add xmlch-type option to configure XMLCh
Modified:
xerces/c/trunk/CMakeLists.txt
xerces/c/trunk/cmake/XercesXMLCh.cmake
xerces/c/trunk/doc/build.xml
Modified: xerces/c/trunk/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/CMakeLists.txt?rev=1822690&r1=1822689&r2=1822690&view=diff
==============================================================================
--- xerces/c/trunk/CMakeLists.txt (original)
+++ xerces/c/trunk/CMakeLists.txt Tue Jan 30 20:01:49 2018
@@ -168,3 +168,4 @@ message(STATUS " Mutex Manager:
message(STATUS " Transcoder: ${transcoder}")
message(STATUS " NetAccessor: ${netaccessor}")
message(STATUS " Message Loader: ${msgloader}")
+message(STATUS " XMLCh type: ${xmlch_type}")
Modified: xerces/c/trunk/cmake/XercesXMLCh.cmake
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/cmake/XercesXMLCh.cmake?rev=1822690&r1=1822689&r2=1822690&view=diff
==============================================================================
--- xerces/c/trunk/cmake/XercesXMLCh.cmake (original)
+++ xerces/c/trunk/cmake/XercesXMLCh.cmake Tue Jan 30 20:01:49 2018
@@ -26,10 +26,6 @@ include(CheckCXXSourceCompiles)
include(CheckTypeSize)
include(XercesIntTypes)
-set(XERCES_XMLCH_T ${XERCES_U16BIT_INT})
-set(XERCES_USE_CHAR16_T 0)
-set(XERCES_INCLUDE_WCHAR_H 0)
-
check_cxx_source_compiles("
int main() {
const char16_t *unicode = u\"Test ünÃcodè â ©\";
@@ -41,19 +37,16 @@ if(HAVE_STD_char16_t)
check_type_size("wchar_t" SIZEOF_WCHAR_T LANGUAGE CXX)
if(NOT SIZEOF_CHAR16_T EQUAL 2)
- message(FATAL_ERROR "char16_t is not a 16-bit type")
- endif()
- if(WIN32)
- if(NOT SIZEOF_WCHAR_T EQUAL 2)
- message(FATAL_ERROR "wchar_t is not a 16-bit type, and size differs from
char16_t")
- endif()
+ message(WARNING "char16_t is not a 16-bit type")
+ elseif(WIN32 AND NOT SIZEOF_WCHAR_T EQUAL 2)
+ message(WARNING "wchar_t is not a 16-bit type, and size differs from
char16_t")
+ else()
+ list(APPEND xmlch_types char16_t)
endif()
+endif()
- set(XERCES_XMLCH_T char16_t)
- set(XERCES_USE_CHAR16_T 1)
-else()
- if(WIN32)
- check_cxx_source_compiles("
+if(WIN32)
+ check_cxx_source_compiles("
#include <windows.h>
wchar_t file[] = L\"dummy.file\";
@@ -64,9 +57,30 @@ int main() {
}"
WINDOWS_wchar)
- if(WINDOWS_wchar)
- set(XERCES_XMLCH_T wchar_t)
- set(XERCES_INCLUDE_WCHAR_H 1)
- endif()
+ if(WINDOWS_wchar)
+ list(APPEND xmlch_types wchar_t)
endif()
endif()
+
+list(APPEND xmlch_types uint16_t)
+
+string(REPLACE ";" "|" xmlch_type_help "${xmlch_types}")
+list(GET xmlch_types 0 xerces_xmlch_type_default)
+set(xmlch-type "${xerces_xmlch_type_default}" CACHE STRING "XMLCh type
(${xmlch_type_help})")
+set(xmlch_type "${xmlch-type}")
+
+list(FIND xmlch_types "${xmlch_type}" xmlch_type_found)
+if(xmlch_type_found EQUAL -1)
+ message(FATAL_ERROR "${xmlch_type} xmlch_type unavailable")
+endif()
+
+set(XERCES_XMLCH_T ${XERCES_U16BIT_INT})
+set(XERCES_USE_CHAR16_T 0)
+set(XERCES_INCLUDE_WCHAR_H 0)
+if(xmlch_type STREQUAL "char16_t")
+ set(XERCES_XMLCH_T char16_t)
+ set(XERCES_USE_CHAR16_T 1)
+elseif(xmlch_type STREQUAL "wchar_t")
+set(XERCES_XMLCH_T wchar_t)
+set(XERCES_INCLUDE_WCHAR_H 1)
+endif()
Modified: xerces/c/trunk/doc/build.xml
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/doc/build.xml?rev=1822690&r1=1822689&r2=1822690&view=diff
==============================================================================
--- xerces/c/trunk/doc/build.xml (original)
+++ xerces/c/trunk/doc/build.xml Tue Jan 30 20:01:49 2018
@@ -146,6 +146,31 @@
</tr>
</table>
+ <p>XMLCh type (UTF-16 character type):</p>
+
+ <table>
+ <tr>
+ <th>Option</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code>-Dxmlch-type=char16_t</code></td>
+ <td>use <code>char16_t</code> (requires a C++11 compiler)</td>
+ </tr>
+ <tr>
+ <td><code>-Dxmlch-type=uint16_t</code></td>
+ <td>use <code>uint16_t</code> from
+ <code><cstdint></code> or
+ <code><stdint.h></code>, or another unsigned
+ 16-bit type such as <code>unsigned short</code> if
+ the standard types are unavailable</td>
+ </tr>
+ <tr>
+ <td><code>-Dxmlch-type=wchar_t</code></td>
+ <td>use <code>wchar_t</code> (Windows only)</td>
+ </tr>
+ </table>
+
<p>Thread support is enabled by default and can be disabled
with the <code>-Dthreads:BOOL=OFF</code> option. If disabled,
it will not be possible to select a mutex manager other than
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]