[sword-svn] r2746 - trunk/cmake
greg.hellings at crosswire.org
greg.hellings at crosswire.org
Fri Nov 16 12:33:21 MST 2012
Author: greg.hellings
Date: 2012-11-16 12:33:21 -0700 (Fri, 16 Nov 2012)
New Revision: 2746
Modified:
trunk/cmake/FindICU.cmake
Log:
Pulled the FindICU.cmake file from BibleTime over, as it does not
depend on the icu-config output. It might need some enhancements in
the future, but this simplifies the process of cross-building, gets
the necessary values in a way more portably-applicable, and shares
effort between maintaining both sets of CMake files.
Modified: trunk/cmake/FindICU.cmake
===================================================================
--- trunk/cmake/FindICU.cmake 2012-11-16 19:33:11 UTC (rev 2745)
+++ trunk/cmake/FindICU.cmake 2012-11-16 19:33:21 UTC (rev 2746)
@@ -5,74 +5,24 @@
# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
# Note: always include ICU headers as, e.g.,
# unicode/utypes.h
-# ICU_DEFINITIONS - Definitions
# ICU_LIBRARIES - Libraries to link against for the common ICU
# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
# (note: in addition to ICU_LIBRARIES)
-# Our first goal is to find the icu-config script, if possible
-find_program(
- ICU_CONFIG_BIN
- icu-config
- HINTS "${ICU_CONFIG_BIN_PATH}"
-)
-find_program(
- ICU_GENRB
- genrb
-)
+# Look for the header file.
+find_path(
+ ICU_INCLUDE_DIR
+ NAMES unicode/utypes.h
+ DOC "Include directory for the ICU library")
+mark_as_advanced(ICU_INCLUDE_DIR)
-if(ICU_CONFIG_BIN)
- MESSAGE(STATUS "[ICU] icu-config: Yes ${ICU_CONFIG_BIN}")
- MESSAGE(STATUS "[ICU] genrb: Yes ${ICU_GENRB}")
+# Look for the library.
+find_library(
+ ICU_LIBRARY
+ NAMES icuuc cygicuuc cygicuuc32
+ DOC "Libraries to link against for the common parts of ICU")
+mark_as_advanced(ICU_LIBRARY)
- # Get include directories
- execute_process(COMMAND "${ICU_CONFIG_BIN}" ${ICU_CONFIG_OPTS} "--cppflags"
- OUTPUT_VARIABLE ICU_CPPFLAGS
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- # Sanitize output
- string(REGEX MATCHALL "-I[^ ]*\ |-I[^ ]*$" ICU_INCLUDE_DIR ${ICU_CPPFLAGS})
- string(REGEX MATCHALL "-D[^ ]*\ |-D[^ ]*$" ICU_DEFINITIONS ${ICU_CPPFLAGS})
- string(REPLACE "-I" "" ICU_INCLUDE_DIR ${ICU_INCLUDE_DIR})
-
- # Try to get the Libraries we need
- execute_process(COMMAND "${ICU_CONFIG_BIN}" ${ICU_CONFIG_OPTS} "--ldflags"
- OUTPUT_VARIABLE ICU_LIBRARY_RAW
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- execute_process(COMMAND "${ICU_CONFIG_BIN}" ${ICU_CONFIG_OPTS} "--ldflags-icuio"
- OUTPUT_VARIABLE ICU_LIBRARY_IO_RAW
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- string(REGEX REPLACE "^[ ]+" "" ICU_LIBRARY ${ICU_LIBRARY_RAW})
- string(REGEX REPLACE "^[ ]+" "" ICU_LIBRARY_IO ${ICU_LIBRARY_IO_RAW})
- # Combine them
- set(ICU_LIBRARY "${ICU_LIBRARY} ${ICU_LIBRARY_IO_RAW}")
-
- # Get the version
- execute_process(COMMAND "${ICU_CONFIG_BIN}" ${ICU_CONFIG_OPTS} "--version"
- OUTPUT_VARIABLE ICU_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-else(ICU_CONFIG_BIN)
-
- # Look for the header file.
- find_path(
- ICU_INCLUDE_DIR
- NAMES unicode/utypes.h
- DOC "Include directory for the ICU library")
- mark_as_advanced(ICU_INCLUDE_DIR)
-
- # Look for the library.
- find_library(
- ICU_LIBRARY
- NAMES icuuc cygicuuc cygicuuc32
- DOC "Libraries to link against for the common parts of ICU")
- mark_as_advanced(ICU_LIBRARY)
-endif(ICU_CONFIG_BIN)
-
# Copy the results to the output variables.
if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
set(ICU_FOUND 1)
@@ -98,5 +48,4 @@
set(ICU_LIBRARIES)
set(ICU_I18N_LIBRARIES)
set(ICU_INCLUDE_DIRS)
- MESSAGE(STATUS "ICU: No")
endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
More information about the sword-cvs
mailing list