Add custom targets to generate tarballs with stored versions
[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 #### Doxygen target ####
16 ########################
17
18 find_package(Doxygen)
19 if(DOXYGEN_FOUND)
20     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/framework.doxyfile.in
21         ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile @ONLY)
22     add_custom_target(doc
23         ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile
24         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
25         COMMENT "Generating API documentation with Doxygen" VERBATIM
26     )
27 endif(DOXYGEN_FOUND)
28
29 ########################################
30 #### get repository tag and version ####
31 ########################################
32
33 include (cmake/get_version.cmake)
34 include (${PROJECT_BINARY_DIR}/version.cmake)
35
36 #############################
37 #### add tarball targets ####
38 #############################
39
40 ADD_CUSTOM_TARGET(targz  COMMAND ${CMAKE_COMMAND}
41                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
42                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
43                                  -D VERSION:STRING=${VERSION}
44                                  -D FORMAT:STRING=tar.gz
45                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
46                                 
47 ADD_CUSTOM_TARGET(tarbz2 COMMAND ${CMAKE_COMMAND}
48                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
49                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
50                                  -D VERSION:STRING=${VERSION}
51                                  -D FORMAT:STRING=tar.bz2
52                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
53 ADD_CUSTOM_TARGET(zip    COMMAND ${CMAKE_COMMAND}
54                                  -D SOURCE:STRING=${CMAKE_SOURCE_DIR}
55                                  -D BINARY:STRING=${PROJECT_BINARY_DIR}
56                                  -D VERSION:STRING=${VERSION}
57                                  -D FORMAT:STRING=zip
58                                  -P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
59
60 #########################
61 #### Compile targets ####
62 #########################
63
64 # add define for length of base path
65 string(LENGTH "${CMAKE_SOURCE_DIR}/" BASELENGTH)
66 add_definitions(-DBASEPATH_LENGTH=${BASELENGTH})
67
68 # include build helper
69 include (cmake/OONFBuildLibrary.cmake)
70
71 # include files
72 include_directories(${PROJECT_BINARY_DIR})
73 include_directories(external)
74 include_directories(src-api)
75
76 if (NOT OONF_NO_TESTING)
77     ENABLE_TESTING()
78 endif (NOT OONF_NO_TESTING)
79
80 # define static and dynamic target
81 add_custom_target(static)
82 add_custom_target(dynamic)
83
84 # start compiling core and plugins
85 add_subdirectory(src-api)
86 add_subdirectory(src-plugins)
87 add_subdirectory(external)
88 # add_subdirectory(examples)
89 add_subdirectory(src)
90
91 if (NOT OONF_NO_TESTING)
92     add_subdirectory(tests)
93 endif (NOT OONF_NO_TESTING)