client-lib: add documentation
[staging/windowmanager.git] / client-lib / CMakeLists.txt
1 #
2 # Copyright (C) 2017 Mentor Graphics Development (Deutschland) GmbH
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 include(FindPkgConfig)
18
19 pkg_check_modules(AFB REQUIRED afb-daemon)
20 pkg_check_modules(SD REQUIRED libsystemd>=222)
21
22 add_library(afbclient SHARED
23    AFBClient.cpp
24    AFBClient.h)
25
26 target_include_directories(afbclient
27     PRIVATE
28         ${AFB_INCLUDE_DIRS}
29         ${SD_INCLUDE_DIRS})
30
31 target_link_libraries(afbclient
32     PRIVATE
33         ${AFB_LIBRARIES}
34         ${WLC_LIBRARIES}
35         ${SD_LIBRARIES})
36
37 target_compile_definitions(afbclient
38     PRIVATE
39         _GNU_SOURCE)  # XXX should I define this here?!
40
41 if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
42    target_compile_definitions(afbclient
43            PRIVATE
44            _GLIBCXX_DEBUG)
45 endif()
46
47 target_compile_options(afbclient
48     PRIVATE
49         -Wall -Wextra -Wno-unused-parameter -Wno-comment)
50
51 set_target_properties(afbclient
52     PROPERTIES
53     # INTERPROCEDURAL_OPTIMIZATION ON
54         CXX_EXTENSIONS OFF
55         CXX_STANDARD 14
56         CXX_STANDARD_REQUIRED ON)
57
58 if (LINK_LIBCXX)
59    set_target_properties(afbclient
60            PROPERTIES
61            LINK_FLAGS "-lc++")
62 endif()
63
64 if (NOT ${SANITIZER_MODE} STREQUAL "none" AND NOT ${SANITIZER_MODE} STREQUAL "")
65    target_compile_options(afbclient
66       PRIVATE
67          -fsanitize=${SANITIZER_MODE} -g -fno-omit-frame-pointer)
68    set_target_properties(afbclient
69       PROPERTIES
70          LINK_FLAGS "-fsanitize=${SANITIZER_MODE} -g")
71 endif()
72
73 install(
74    TARGETS afbclient
75    DESTINATION ${CMAKE_INSTALL_LIBDIR}
76    COMPONENT "runtime")
77
78 install(
79    FILES AFBClient.h
80    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
81    COMPONENT "development")
82
83 add_subdirectory(doc)