-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
59 lines (50 loc) · 1.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 2.8)
project(libastphonenumber)
set(libastphonenumber_VERSION_MAJOR 1)
set(libastphonenumber_VERSION_MINOR 3)
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
endif()
set(
ASTPHONENUMBER_SOURCE
src/formatting.cpp
src/numinfo.cpp
src/regioninfo.cpp)
# STATIC LIBRARY
add_library(astphonenumber STATIC ${ASTPHONENUMBER_SOURCE})
target_link_libraries(astphonenumber phonenumber)
set_property(TARGET astphonenumber PROPERTY POSITION_INDEPENDENT_CODE ON)
# SHARED LIBRARY
add_library(astphonenumber-shared SHARED ${ASTPHONENUMBER_SOURCE})
set_target_properties(astphonenumber-shared
PROPERTIES
OUTPUT_NAME "astphonenumber"
PREFIX "lib"
SOVERSION ${libastphonenumber_VERSION_MAJOR}
VERSION ${libastphonenumber_VERSION_MAJOR}.${libastphonenumber_VERSION_MINOR})
target_link_libraries(astphonenumber-shared phonenumber)
set_property(TARGET astphonenumber-shared PROPERTY POSITION_INDEPENDENT_CODE ON)
# INSTALL
SET(CMAKE_INSTALL_PREFIX /usr)
install(FILES
src/formatting.h
src/numinfo.h
src/regioninfo.h
DESTINATION include/astphonenumber/
)
install(TARGETS astphonenumber LIBRARY DESTINATION lib/ ARCHIVE DESTINATION lib/)
install(TARGETS astphonenumber-shared LIBRARY DESTINATION lib/ ARCHIVE DESTINATION lib/)
# TEST
add_executable(
libastphonenumber_tester
"test/test_lib_dyn_load.c"
)
target_link_libraries(libastphonenumber_tester dl)
add_executable(
libastphonenumber_static_tester
"test/display.c"
"test/tester_static.c"
)
target_link_libraries(libastphonenumber_static_tester astphonenumber)
# INSTALL tester
install(TARGETS libastphonenumber_tester RUNTIME DESTINATION bin/ ARCHIVE DESTINATION bin/)