forked from mobilinkd/m17-cxx-demod
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
76 lines (59 loc) · 2.12 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
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required(VERSION 3.9)
project(opvcxx
VERSION 0.2
DESCRIPTION "OPV Digital Voice modulation and demodulation"
LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
# Require out-of-source builds
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
if(EXISTS "${LOC_PATH}")
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
endif()
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
message(STATUS "Build type not specified: defaulting to release.")
endif()
# Check for dependencies
message(STATUS "# Checking dependencies")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include(GNUInstallDirs)
#find_package(Opus REQUIRED)
set(Boost_USE_STATIC_LIBS FALSE)
find_package(Boost COMPONENTS program_options REQUIRED)
# Add subdirectories
add_subdirectory(src)
add_subdirectory(apps)
find_package(GTest)
if(GTEST_FOUND)
enable_testing()
add_subdirectory(tests)
endif()
# Setup installation
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/opvcxxConfigVersion.cmake"
VERSION 0.2
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/opvcxxConfig.cmake.in"
"${PROJECT_BINARY_DIR}/opvcxxConfig.cmake"
INSTALL_DESTINATION lib/cmake/opvcxx
)
install(EXPORT opvcxxTargets DESTINATION lib/cmake/opvcxx)
install(FILES "${PROJECT_BINARY_DIR}/opvcxxConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/opvcxxConfig.cmake"
DESTINATION lib/cmake/opvcxx)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
# Create uninstall target
configure_file(
${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY)
add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
# Print summary
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Building version: ${PROJECT_VERSION}")