Fix make widget bug for sample source
[src/libhomescreen.git] / src / CMakeLists.txt
1 #
2 # Copyright (c) 2017 TOYOTA MOTOR CORPORATION
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
18 cmake_minimum_required(VERSION 3.0)
19
20 set(TARGET_LIBHOMESCREEN homescreen)
21 add_definitions("-std=c++11")
22
23 pkg_check_modules(libhomescreen_depends  json-c libafbwsc libsystemd)
24 set(libhomescreen_sources libhomescreen.cpp)
25
26 include_directories(${LIBHOMESCREEN_INCLUDE_DIR})
27 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
28
29 add_library(${TARGET_LIBHOMESCREEN} SHARED ${libhomescreen_sources})
30 target_compile_options(${TARGET_LIBHOMESCREEN} PUBLIC ${libhomescreen_depends_CFLAGS})
31
32 if(DEFINED DEBUGMODE)
33  target_compile_options(${TARGET_LIBHOMESCREEN} PRIVATE -g -O0)
34 else(DEFINED DEBUGMODE)
35  target_compile_options(${TARGET_LIBHOMESCREEN} PRIVATE -g -O2)
36 endif(DEFINED DEBUGMODE)
37
38 include_directories(${TARGET_LIBHOMESCREEN} ${libhomescreen_depends_INCLUDE_DIRS})
39 target_link_libraries(${TARGET_LIBHOMESCREEN} afbwsc -lpthread ${link_libraries} ${libhomescreen_depends_LIBRARIES})
40 set_target_properties(${TARGET_LIBHOMESCREEN}
41     PROPERTIES
42     VERSION 0.1
43 )
44
45 if(DEFINED CMAKE_INSTALL_LIBDIR)
46     INSTALL(TARGETS ${TARGET_LIBHOMESCREEN}
47     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
48 endif(DEFINED CMAKE_INSTALL_LIBDIR)