This repository has been archived by the owner on Mar 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (55 loc) · 1.74 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
64
65
cmake_minimum_required(VERSION 3.12.4) # Потому что это ранняя проверенная.
if($ENV{TRAVIS_BUILD_NUMBER})
set(VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER})
else()
set(VERSION 0.0.0)
endif()
project(helloworld VERSION ${VERSION})
set_target_properties(${TARGET} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
find_package(Boost 1.21.0 COMPONENTS unit_test_framework)
set(GTEST_SRCDIR "/usr/src/gtest/")
set(SRC_PATH "src/")
include_directories("inc/")
add_library(helloworld ${SRC_PATH}/helloworld.cpp)
add_executable(helloworld_cli ${SRC_PATH}/main.cpp)
set_target_properties(helloworld_cli PROPERTIES OUTPUT_NAME helloworld)
target_link_libraries(helloworld_cli helloworld)
if(Boost_FOUND)
add_executable(boost_test_suite ${SRC_PATH}/boost_test.cpp)
target_link_libraries(
boost_test_suite
PRIVATE
helloworld
Boost::unit_test_framework)
enable_testing()
add_test(boost_test_suite boost_test_suite)
else()
message(
WARNING
"Boost test suite will not be launched because Boost ist not found.")
endif()
if(EXISTS "${GTEST_SRCDIR}/CMakeLists.txt")
add_subdirectory(${GTEST_SRCDIR}/ ${CMAKE_BINARY_DIR}/gtest/ EXCLUDE_FROM_ALL)
add_executable(gtest_test_suite ${SRC_PATH}/gtest_test.cpp)
target_link_libraries(
gtest_test_suite
PRIVATE
helloworld
gtest)
enable_testing()
add_test(gtest_test_suite gtest_test_suite)
else()
message(
WARNING
"GTest test suite will not be launched because GTest sources is not found"
" at ${GTEST_SRCDIR}.")
endif()
install(TARGETS helloworld_cli RUNTIME DESTINATION bin)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_CONTACT bergentroll@insiberia.net)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.15)")
include(CPack)