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