Browse Source

Merge pull request #11265 from Michael-Gardner/unicode-library-version

HPCC-19847 Unicode library version check and c++ standard change

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 6 years ago
parent
commit
6196f85371
3 changed files with 15 additions and 5 deletions
  1. 13 2
      cmake_modules/FindICU.cmake
  2. 0 2
      cmake_modules/commonSetup.cmake
  3. 2 1
      rtl/eclrtl/CMakeLists.txt

+ 13 - 2
cmake_modules/FindICU.cmake

@@ -21,6 +21,7 @@
 #  ICU_FOUND - system has the ICU library
 #  ICU_INCLUDE_DIR - the ICU include directory
 #  ICU_LIBRARIES - The libraries needed to use ICU
+#  ICU_VERSION - Version of unicode library
 
 IF (NOT ICU_FOUND)
   IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
@@ -51,11 +52,22 @@ IF (NOT ICU_FOUND)
     FIND_LIBRARY (ICU_LIBRARIES NAMES icuuc)
   endif()
 
+  if(EXISTS ${ICU_INCLUDE_DIR}/unicode/uchar.h)
+    file(STRINGS ${ICU_INCLUDE_DIR}/unicode/uchar.h __ICU_VERSION REGEX
+        "^#define U_UNICODE_VERSION*")
+    string(REPLACE "#define U_UNICODE_VERSION" "" __ICU_VERSION
+        ${__ICU_VERSION})
+    string(REPLACE "\"" "" __ICU_VERSION ${__ICU_VERSION})
+    string(STRIP "${__ICU_VERSION}" __ICU_VERSION)
+    set(ICU_VERSION "${__ICU_VERSION}" CACHE STRING "unicode library version")
+  endif()
+
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(ICU DEFAULT_MSG
     ICU_LIBRARIES 
     ICU_INCLUDE_DIR
   )
+  message(STATUS "  version: ${ICU_VERSION}")
   IF (ICU_FOUND)
     IF (UNIX)
       STRING(REPLACE "icuuc" "icui18n" ICU_EXTRA1 "${ICU_LIBRARIES}")
@@ -68,6 +80,5 @@ IF (NOT ICU_FOUND)
     set (ICU_LIBRARIES ${ICU_EXTRA1} ${ICU_LIBRARIES} ${ICU_EXTRA2} )
   ENDIF()
 
-
-  MARK_AS_ADVANCED(ICU_INCLUDE_DIR ICU_LIBRARIES)
+  MARK_AS_ADVANCED(ICU_INCLUDE_DIR ICU_LIBRARIES ICU_VERSION)
 ENDIF()

+ 0 - 2
cmake_modules/commonSetup.cmake

@@ -259,8 +259,6 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     set( PORTALURL "http://hpccsystems.com/download" )
   endif()
 
-  option(ICU_REQUIRES_CPP11 "Require C++11 for ICU support" OFF)
-
   if(UNIX AND SIGN_MODULES)
       execute_process(COMMAND bash "-c" "gpg --version | awk 'NR==1{print $3}'"
         OUTPUT_VARIABLE GPG_VERSION

+ 2 - 1
rtl/eclrtl/CMakeLists.txt

@@ -80,7 +80,8 @@ include_directories (
 ADD_DEFINITIONS( -D_USRDLL -DECLRTL_EXPORTS )
 
 if (USE_BOOST_REGEX)
-    if ((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) AND (${BOOST_REGEX_VERSION} LESS 105700) AND NOT ICU_REQUIRES_CPP11)
+    if ((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) AND (${BOOST_REGEX_VERSION} LESS 105700) AND 
+        (ICU_VERSION VERSION_LESS "10.0"))
         set_source_files_properties(eclregex.cpp PROPERTIES COMPILE_FLAGS -std=c++98)
     endif ()