Small corrections. Compiles and builds.
[libt2n] / examples-codegen / example1 / CMakeLists.txt
CommitLineData
471f240f
KK
1# Project
2project(libt2n-example1)
3set(VERSION 0.1)
4set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
5
6# CMake
7set(CMAKE_COLOR_MAKEFILE ON)
8cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
9
10# Source package generation
11set(CPACK_SOURCE_GENERATOR TGZ)
12set(CPACK_SOURCE_IGNORE_FILES "~$;\\\\.git;build;build-rpm")
13set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}")
14
15# Find external packages
16include(FindPkgConfig)
17
18pkg_check_modules(LIBT2N REQUIRED libt2n>=0.2)
19include_directories(${LIBT2N_INCLUDE_DIRS})
20link_directories(${LIBT2N_LIBRARY_DIRS})
21
22include(CPack)
23
24# Setup libt2n
25# for each command group list the files to parse for LIBT2N_EXPORT
26set(t2nexample_GROUP ${CMAKE_CURRENT_SOURCE_DIR}/t2nexample.cpp)
27# include CMake snippet doing all the magic
7ba38527 28include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Libt2n.cmake)
471f240f
KK
29# command groups are listed here (seperated by spaces)
30setup_libt2n(t2nexample)
31
32# Sources
33# for each group build a client library from generated source file(s)
34# Note: the library name must match the group name
35set(libt2nexample_SOURCES
36 t2nexample_client.cpp
37)
38set(libt2n_example1_server_SOURCES
39 server.cpp
40 ${t2nexample_GROUP}
41 t2nexample_server.cpp
42)
43
44# Executables
45# build server program
46add_executable(libt2n-example1-server ${libt2n_example1_server_SOURCES})
47
48# Libraries
49add_library(libt2nexample STATIC ${libt2nexample_SOURCES})
50set_target_properties(libt2nexample PROPERTIES OUTPUT_NAME t2nexample)
51
52# Dependencies
53target_link_libraries(libt2n-example1-server ${LIBT2N_LIBRARIES})
54target_link_libraries(libt2nexample t2nexample ${LIBT2N_LIBRARIES})
55
56add_dependencies(libt2n-example1-server t2n_arnielizer_codegen_done)
57add_dependencies(libt2nexample t2n_arnielizer_codegen_done)
58
59# Installation
60# install(TARGETS libt2n-example1-server DESTINATION bin)
61# install(TARGETS libt2nexample ARCHIVE DESTINATION lib)