-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
52 lines (36 loc) · 1.22 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
cmake_minimum_required(VERSION 3.2)
project(helloworld VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER})
set(BUILDNUM "${PROJECT_VERSION_PATCH}")
find_package(Threads REQUIRED)
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
configure_file(buildNumber.h.in ${PROJECT_SOURCE_DIR}/buildNumber.h)
add_executable(helloworld main.cpp)
add_library(library lib.cpp)
add_executable(test_build test_build.cpp)
set_target_properties(helloworld library test_build PROPERTIES
CXXSTANDARD 17
CSS_STANDARD_REQUIRED ON
COMPILE_OPTIONS "-Wpedantic;-Wall;-Wextra"
)
set_target_properties(test_build PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK
INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
)
target_link_libraries(helloworld
library
Threads::Threads
)
target_link_libraries(test_build
${Boost_LIBRARIES}
library
)
install(TARGETS helloworld RUNTIME DESTINATION bin)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT [email protected])
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
include(CPack)
enable_testing()
add_test(helloworld_tests test_build)