Browse Source

Cpp:Improves dependency detection in CMakeLists.txt and update Readme.

pull/567/head
Philip Liard 15 years ago
committed by Mihaela Rosca
parent
commit
ff0ef17886
2 changed files with 31 additions and 3 deletions
  1. +18
    -2
      cpp/CMakeLists.txt
  2. +13
    -1
      cpp/README

+ 18
- 2
cpp/CMakeLists.txt View File

@ -64,6 +64,22 @@ if (PROTOC STREQUAL "PROTOC-NOTFOUND")
"Please read README.")
endif ()
# Find Protocol Buffers library
find_path (PROTOBUF_INCLUDE_DIR google/protobuf/message_lite.h)
if (PROTOBUF_INCLUDE_DIR STREQUAL "PROTOBUF_INCLUDE_DIR-NOTFOUND")
message (FATAL_ERROR
"Can't find Google Protocol headers. Please read README.")
endif ()
include_directories (${PROTOBUF_INCLUDE_DIR})
find_library (PROTOBUF_LIB protobuf)
if (PROTOBUF_LIB STREQUAL "PROTOBUF_LIB-NOTFOUND")
message (FATAL_ERROR
"Can't find Google Protocol Buffers library. Please read README.")
endif ()
# Find ICU
find_path (ICU_INCLUDE_DIR unicode/unistr.h unicode/normlzr.h)
@ -176,7 +192,7 @@ include_directories (".")
add_library (phonenumber STATIC ${SOURCES})
add_dependencies (phonenumber generate-sources)
target_link_libraries (phonenumber re2 protobuf icui18n)
target_link_libraries (phonenumber ${RE2_LIB} ${PROTOBUF_LIB} ${ICU_LIB})
# Tests
@ -190,4 +206,4 @@ set (TEST_SOURCES
add_executable (libphonenumber_test ${TEST_SOURCES})
target_link_libraries (libphonenumber_test phonenumber gtest pthread)
target_link_libraries (libphonenumber_test phonenumber ${GTEST_LIB} pthread)

+ 13
- 1
cpp/README View File

@ -14,6 +14,18 @@ Requirements:
You can install it very easily on a Debian-based GNU/Linux distribution:
$ sudo apt-get install cmake
- Protocol Buffers
http://code.google.com/p/protobuf/
You can install it very easily on a Debian-based GNU/Linux distribution:
$ sudo apt-get install libprotobuf-dev
- Google Test
http://code.google.com/p/googletest/
You can install it very easily on a Debian-based GNU/Linux distribution:
$ sudo apt-get install libgtest-dev
- RE2
http://code.google.com/p/re2/
@ -46,5 +58,5 @@ How to build libphonenumber C++:
$ cd libphonenumber
$ mkdir build
$ cd build
$ cmake ..
$ cmake ../cpp/
$ make

Loading…
Cancel
Save