CMakeLists.txt 3.06 KB
Newer Older
1
2
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)

3
PROJECT(doocs-TC4-EqFct)
4

5
SET(${PROJECT_NAME}_MAJOR_VERSION 01)
6
7
SET(${PROJECT_NAME}_MINOR_VERSION 06)
SET(${PROJECT_NAME}_PATCH_VERSION 00)
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
include(${CMAKE_SOURCE_DIR}/cmake/set_version_numbers.cmake)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

# Set the build type to Release if none is specified
# Force it into Release if "None" is specified (needed to overrule dkpg_buildpackage)
if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None")
  set(CMAKE_BUILD_TYPE "Release" CACHE STRING
      "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
endif(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -pedantic -Wuninitialized")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 --coverage")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

24
#enable code coverage report.
25
include(cmake/enable_code_coverage_report.cmake)
26
27
28
29

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${PROJECT_NAME}_CXX_FLAGS}")

include(${CMAKE_SOURCE_DIR}/cmake/add_dependency.cmake)
30
31
add_dependency(DOOCS 18.10.11 server REQUIRED)
add_dependency(DAction 2.5 REQUIRED)
32
add_dependency(mtca4u-deviceaccess 00.21 REQUIRED)
33
add_dependency(Doocs-RF-Util 0.1 REQUIRED)
34
35
36
37
38
39
40

include_directories(${PROJECT_SOURCE_DIR}/include)
AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src LIB_SOURCES)

ADD_LIBRARY(${PROJECT_NAME} SHARED ${LIB_SOURCES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_FULL_LIBRARY_VERSION} SOVERSION ${${PROJECT_NAME}_SOVERSION})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
41
target_link_libraries(${PROJECT_NAME} ${mtca4u-deviceaccess_LIBRARIES} ${DOOCS_LIBRARIES} ${DAction_LIBRARIES} ${Doocs-RF-Util_LIBRARIES})
42
43
44
45
46

#Create the config files by filling the correct variables into the template (*.cmake.in).
#All variables @VARIABLE@ are replaced with the current values, but they have to be set first....
#Only the reference header is needed. The other variables are for dependencies of this library,
#but there are none.
47
48
49
50
#
#We 'only' give the DAction flags. They already include the DOOCS and DeviceAccess stuff.
set(${PROJECT_NAME}_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include ${DAction_INCLUDE_DIRS}")
set(${PROJECT_NAME}_LIBRARIES "${DAction_LIBRARIES}")
51
52
#note: the ${FuseRelayBoard_LIBRARY_DIRS} is not needed as the library itself is absolute. It would even disturb because
#it might sneak in a system directory.
53
54
set(${PROJECT_NAME}_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib ${DAction_LIBRARY_DIRS}")
set(${PROJECT_NAME}_CXX_FLAGS "${${PROJECT_NAME}_CXX_FLAGS} ${DAction_CXX_FLAGS}")
55
56
57
58
59
60
61
set(${PROJECT_NAME}_LINKER_FLAGS "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib,--enable-new-dtags")
include(${CMAKE_SOURCE_DIR}/cmake/create_cmake_config_files.cmake)

INSTALL(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
INSTALL(TARGETS ${PROJECT_NAME}
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
62
        ARCHIVE DESTINATION lib)
63
64
65
66

#the section for the automatic tests:
ENABLE_TESTING()
add_subdirectory(tests)