-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
39 lines (31 loc) · 1.32 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
cmake_minimum_required(VERSION 2.8.4)
project(asio_service_discovery)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wconversion")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdocumentation")
endif()
# this is here, so that users can use a custom boost installation
# used also by travis CI
if(EXISTS "$ENV{BOOST_ROOT}")
link_directories("$ENV{BOOST_ROOT}/lib")
include_directories("$ENV{BOOST_ROOT}/include")
endif(EXISTS "$ENV{BOOST_ROOT}")
# create documentation
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(
doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
file(GLOB tests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/tests" "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp")
foreach(test_file ${tests})
message(${test_file})
get_filename_component(test_name ${test_file} NAME_WE)
add_executable(${test_name} "${CMAKE_CURRENT_SOURCE_DIR}/tests/${test_file}")
target_include_directories(${test_name} PUBLIC "./include")
target_link_libraries(${test_name} "boost_system" "boost_unit_test_framework")
endforeach(test_file)