# Options that can be passed to CMake using 'cmake -DKEY=VALUE'.
option ("BUILD_GEOCODER" "Build the offline phone number geocoder" "ON")
+option ("USE_ALTERNATE_FORMATS" "Use alternate formats" "ON")
option ("USE_BOOST" "Use Boost" "ON")
option ("USE_ICU_REGEXP" "Use ICU regexp engine" "ON")
option ("USE_LITE_METADATA" "Use lite metadata" "OFF")
option ("USE_RE2" "Use RE2" "OFF")
option ("USE_STD_MAP" "Force the use of std::map" "OFF")
+if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+ add_definitions ("-DI18N_PHONENUMBERS_USE_ALTERNATE_FORMATS")
+endif ()
+
# Find all the required libraries and programs.
if (${USE_BOOST} STREQUAL "ON")
add_definitions ("-DI18N_PHONENUMBERS_USE_BOOST")
add_definitions ("-DI18N_PHONENUMBERS_USE_ICU_REGEXP")
list (APPEND SOURCES "src/phonenumbers/regexp_adapter_icu.cc")
# The phone number matcher needs ICU.
- list (APPEND SOURCES "src/phonenumbers/alternate_format.cc")
list (APPEND SOURCES "src/phonenumbers/phonenumbermatch.cc")
list (APPEND SOURCES "src/phonenumbers/phonenumbermatcher.cc")
+ if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+ list (APPEND SOURCES "src/phonenumbers/alternate_format.cc")
+ endif ()
endif ()
# Library sources excluding the metadata files, since special metadata is used
list (APPEND TESTING_LIBRARY_SOURCES "src/phonenumbers/test_metadata.cc")
if (${USE_ICU_REGEXP} STREQUAL "ON")
- # Add alternate format metadata generation for the phone number matcher
- set (ALT_FORMAT_METADATA_TARGET "generate-alt-format-metadata")
- add_metadata_gen_target (
- ${ALT_FORMAT_METADATA_TARGET}
- "${RESOURCES_DIR}/PhoneNumberAlternateFormats.xml"
- "alternate_format"
- "alternate_format"
- )
+ if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+ # Add alternate format metadata generation for the phone number matcher.
+ set (ALT_FORMAT_METADATA_TARGET "generate-alt-format-metadata")
+ add_metadata_gen_target (
+ ${ALT_FORMAT_METADATA_TARGET}
+ "${RESOURCES_DIR}/PhoneNumberAlternateFormats.xml"
+ "alternate_format"
+ "alternate_format"
+ )
+ endif ()
endif ()
if (NOT WIN32)
# Build a static library (without -fPIC).
add_library (phonenumber STATIC ${SOURCES})
if (${USE_ICU_REGEXP} STREQUAL "ON")
- add_dependencies (phonenumber ${ALT_FORMAT_METADATA_TARGET})
+ if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+ add_dependencies (phonenumber ${ALT_FORMAT_METADATA_TARGET})
+ endif ()
endif ()
if (${BUILD_GEOCODER} STREQUAL "ON")
if (BUILD_SHARED_LIB)
add_library (phonenumber-shared SHARED ${SOURCES})
if (${USE_ICU_REGEXP} STREQUAL "ON")
- add_dependencies (phonenumber ${ALT_FORMAT_METADATA_TARGET})
+ if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+ add_dependencies (phonenumber ${ALT_FORMAT_METADATA_TARGET})
+ endif ()
endif ()
set_target_properties (phonenumber-shared
PROPERTIES
Build parameters can be specified invoking CMake with '-DKEY=VALUE' or using a
CMake user interface (ccmake or cmake-gui).
- USE_BOOST = ON | OFF [ON] -- Use Boost. This is only needed in
- multi-threaded environments.
- USE_ICU_REGEXP = ON | OFF [ON] -- Use ICU regexp engine.
- USE_LITE_METADATA = ON | OFF [OFF] -- Generates smaller metadata that doesn't
- include example numbers.
- USE_RE2 = ON | OFF [OFF] -- Use RE2.
- USE_STD_MAP = ON | OFF [OFF] -- Force the use of std::map.
+ USE_ALTERNATE_FORMATS = ON | OFF [ON] -- Use alternate formats for the phone
+ number matcher.
+ USE_BOOST = ON | OFF [ON] -- Use Boost. This is only needed in
+ multi-threaded environments.
+ USE_ICU_REGEXP = ON | OFF [ON] -- Use ICU regexp engine.
+ USE_LITE_METADATA = ON | OFF [OFF] -- Generates smaller metadata that
+ doesn't include example numbers.
+ USE_RE2 = ON | OFF [OFF] -- Use RE2.
+ USE_STD_MAP = ON | OFF [OFF] -- Force the use of std::map.