-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
63 lines (52 loc) · 1.85 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required(VERSION 3.7)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
project(icnlowpan VERSION 0.1 LANGUAGES C)
option(BUILD_DOC "Build documentation" ON)
option(BUILD_DEBUG "Build with debug" ON)
option(BUILD_NDNLOWPAN "Build NDNLoWPAN" ON)
option(BUILD_CCNLOWPAN "Build CCNLoWPAN" OFF)
include(CTest)
if (BUILD_TESTING)
add_library(unity STATIC "Unity/src/unity.c")
target_include_directories(unity PUBLIC "Unity/src")
endif (BUILD_TESTING)
if (BUILD_DOC)
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
add_custom_target( doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen not found")
endif (DOXYGEN_FOUND)
endif (BUILD_DOC)
FUNCTION(add_static_library TARGET)
add_library(${TARGET} STATIC "")
set_target_properties(${TARGET} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
ENDFUNCTION()
if (BUILD_DEBUG)
add_definitions(-DICNL_DEBUG=1)
endif (BUILD_DEBUG)
add_definitions(-DMODULE_ICNLOWPAN)
if (BUILD_NDNLOWPAN)
add_definitions(-DMODULE_NDNLOWPAN)
endif(BUILD_NDNLOWPAN)
add_subdirectory(icnlowpan)
if (BUILD_NDNLOWPAN)
add_subdirectory(ndnlowpan)
endif (BUILD_NDNLOWPAN)