Add script to generate Debian package files for static applications
[oonf.git] / CMakeLists.txt
1 project (OONF C)
2 cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
3
4 ###########################
5 #### API configuration ####
6 ###########################
7
8 # set cached variables
9 include (./cmake/lib_config.cmake)
10
11 # include compiler flags
12 include (./cmake/cc_flags.cmake)
13
14 ########################################
15 #### get repository tag and version ####
16 ########################################
17
18 include (cmake/get_version.cmake)
19 IF(EXISTS "${PROJECT_BINARY_DIR}/version.cmake")
20   include (${PROJECT_BINARY_DIR}/version.cmake)
21 ENDIF()
22
23 ########################
24 #### Doxygen target ####
25 ########################
26
27 find_package(Doxygen)
28 if(DOXYGEN_FOUND)
29     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/framework.doxyfile.in
30         ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile @ONLY)
31     add_custom_target(doc
32         ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile
33         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
34         COMMENT "Generating API documentation with Doxygen" VERBATIM
35     )
36 endif(DOXYGEN_FOUND)
37
38 #############################
39 #### add tarball targets ####
40 #############################
41
42 ADD_CUSTOM_TARGET(targz  COMMAND ${CMAKE_COMMAND}
43                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
44                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
45                                  -D VERSION:STRING=${VERSION}
46                                  -D FORMAT:STRING=tar.gz
47                                  -D TARBALL:STRING=${TARBALL}
48                                  -D TARPREFIX:STRING=${TARPREFIX}
49                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
50                                 
51 ADD_CUSTOM_TARGET(tarbz2 COMMAND ${CMAKE_COMMAND}
52                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
53                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
54                                  -D VERSION:STRING=${VERSION}
55                                  -D FORMAT:STRING=tar.bz2
56                                  -D TARBALL:STRING=${TARBALL}
57                                  -D TARPREFIX:STRING=${TARPREFIX}
58                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
59 ADD_CUSTOM_TARGET(zip    COMMAND ${CMAKE_COMMAND}
60                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
61                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
62                                  -D VERSION:STRING=${VERSION}
63                                  -D FORMAT:STRING=zip
64                                  -D TARBALL:STRING=${TARBALL}
65                                  -D TARPREFIX:STRING=${TARPREFIX}
66                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
67
68 #########################
69 #### Compile targets ####
70 #########################
71
72 # add define for length of base path
73 string(LENGTH "${CMAKE_SOURCE_DIR}/" BASELENGTH)
74 add_definitions(-DBASEPATH_LENGTH=${BASELENGTH})
75
76 # include build helper
77 include (cmake/declare_library.cmake)
78
79 # include files
80 include_directories(${PROJECT_BINARY_DIR})
81 include_directories(src-api)
82
83 if (NOT OONF_NO_TESTING)
84     ENABLE_TESTING()
85 endif (NOT OONF_NO_TESTING)
86
87 # define static and dynamic target
88 add_custom_target(static)
89 add_custom_target(dynamic)
90
91 # start compiling core and plugins
92 add_subdirectory(src-api)
93 add_subdirectory(src-plugins)
94 # add_subdirectory(examples)
95 add_subdirectory(src)
96
97 if (NOT OONF_NO_TESTING)
98     add_subdirectory(tests)
99 endif (NOT OONF_NO_TESTING)