2 project(libt2n-example2)
4 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
7 set(CMAKE_COLOR_MAKEFILE ON)
8 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
10 # Source package generation
11 set(CPACK_SOURCE_GENERATOR TGZ)
12 set(CPACK_SOURCE_IGNORE_FILES "~$;\\\\.git;build;build-rpm")
13 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}")
15 # Find external packages
16 include(FindPkgConfig)
18 pkg_check_modules(LIBT2N REQUIRED libt2n>=0.2)
19 include_directories(${LIBT2N_INCLUDE_DIRS})
20 link_directories(${LIBT2N_LIBRARY_DIRS})
25 # for each command group list the files to parse for LIBT2N_EXPORT
27 ${CMAKE_CURRENT_SOURCE_DIR}/default.cpp
29 # example of a command group using multiple cpp files
31 ${CMAKE_CURRENT_SOURCE_DIR}/other-1.cpp
32 ${CMAKE_CURRENT_SOURCE_DIR}/other-2.cpp
35 # ${CMAKE_CURRENT_SOURCE_DIR}/foo.hxx
37 # include CMake snippet doing all the magic
38 include(${CMAKE_SOURCE_DIR}/codegen/Libt2n.cmake)
39 # command groups are listed here (seperated by spaces)
40 setup_libt2n(default other)
43 # for each group build a client library from generated source file(s)
44 # Note: the library name must match the group name
45 set(libdefault_SOURCES
51 # build an example server and client
55 set(libt2n_example2_server_SOURCES
64 add_library(libdefault STATIC ${libdefault_SOURCES})
65 set_target_properties(libdefault PROPERTIES OUTPUT_NAME default)
67 add_library(libother STATIC ${libother_SOURCES})
68 set_target_properties(libother PROPERTIES OUTPUT_NAME other)
71 # build server program
72 add_executable(libt2n-example2-server ${libt2n_example2_server_SOURCES})
75 target_link_libraries(libdefault ${LIBT2N_LIBRARIES})
76 add_dependencies(libdefault default_codegen_done)
78 target_link_libraries(libother ${LIBT2N_LIBRARIES})
79 add_dependencies(libother other_codegen_done)
81 target_link_libraries(libt2n-example2-server ${LIBT2N_LIBRARIES} libdefault libother)
82 add_dependencies(libt2n-example2-server default_codegen_done other_codegen_done)
85 # install(TARGETS default_client ARCHIVE DESTINATION lib)
86 # install(TARGETS other_client ARCHIVE DESTINATION lib)
87 # install(TARGETS libt2n-example2-server DESTINATION bin)
88 # install(FILES ${CPP_HEADERS} DESTINATION include)
89 # install(PROGRAMS test DESTINATION ./)