-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
91 lines (76 loc) · 2.71 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# @@@LICENSE
#
# Copyright (c) 2009-2014 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# LICENSE@@@
cmake_minimum_required(VERSION 2.8.7)
project(pbnjson)
include(webOS/webOS)
webos_modules_init(1 0 0 QUALIFIER RC3)
webos_component(2 9 1)
add_definitions(-DWEBOS_COMPONENT_VERSION="${WEBOS_COMPONENT_VERSION}")
include(FindPkgConfig)
find_library(GMP_LIBRARY gmp ${LIB_INSTALL_DIR})
find_package(Threads)
# prefer local headers
include_directories(include/public)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL -Wall -D__STRICT_ANSI__ ${GLIB2_CFLAGS_OTHER} -pthread)
set(NO_LOGGING FALSE CACHE BOOL "Do not use logging")
if(NO_LOGGING)
webos_add_compiler_flags(ALL -DPJSON_NO_LOGGING)
else()
pkg_check_modules(PMLOGLIB REQUIRED PmLogLib-headers)
include_directories(${PMLOGLIB_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PMLOGLIB_CFLAGS_OTHER})
endif()
# YAJL-1 doesn't ship any pkg-check module
pkg_check_modules(YAJL yajl)
if("${YAJL_VERSION}" STREQUAL "")
message(STATUS "Looking for YAJL in library paths")
find_library(YAJL_LDFLAGS yajl ${LIB_INSTALL_DIR})
if(${YAJL_LDFLAGS} STREQUAL "YAJL_LDFLAGS-NOTFOUND")
message(FATAL_ERROR "Cannot find YAJL")
else()
message(STATUS "Found ${YAJL_LDFLAGS}")
endif()
else()
include_directories(${YAJL_INCLUDE_DIRS})
endif()
pkg_check_modules(URIPARSER REQUIRED liburiparser)
include_directories(${URIPARSER_INCLUDE_DIRS})
find_program(GPERF NAMES gperf DOC "GNU gperf perfect hash function generator")
if(${GPERF} STREQUAL "GPERF-NOTFOUND")
message(FATAL_ERROR "Cannot find GNU gperf executable")
endif()
find_program(LEMON NAMES lemon DOC "The LEMON LALR(1) parser generator")
if(${LEMON} STREQUAL "LEMON-NOTFOUND")
message(FATAL_ERROR "Cannot find lemon LALR(1) parser generator")
endif()
set(API_HEADERS ${CMAKE_SOURCE_DIR}/include/public)
set(WITH_GTEST_SRC "/usr/src/gtest" CACHE PATH "Path to Google Test source code")
add_subdirectory(src)
if(WITH_DOCS)
add_subdirectory(doc)
else()
message(STATUS "Skipping document generation")
endif()
if(WITH_TESTS)
include(CTest)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
else()
message(STATUS "Skipping automatic tests")
endif()