-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (46 loc) · 1.26 KB
/
CMakeLists.txt
File metadata and controls
58 lines (46 loc) · 1.26 KB
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
cmake_minimum_required(VERSION 4.0)
# Generate compile commands for anyone using our libraries.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
project(audio-cpp LANGUAGES CXX)
static_library(
ENABLE_TESTS ON
UNIT_TEST_SOURCES
tests/main.test.cpp
tests/basic_audio.test.cpp
LOCAL_PACKAGES
audio-cpp
PACKAGES
miniaudio
LINK_PACKAGES
miniaudio::miniaudio
)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)
target_sources(${PROJECT_NAME} PUBLIC
FILE_SET CXX_MODULES
TYPE CXX_MODULES
FILES
audio-cpp/audio.cppm
audio-cpp/sound.cppm
)
install(
TARGETS ${PROJECT_NAME}
EXPORT audio-cpp_targets
FILE_SET CXX_MODULES DESTINATION "."
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
CXX_MODULES_BMI DESTINATION "bmi"
)
install(
EXPORT audio-cpp_targets
FILE "audio-cpp-config.cmake"
DESTINATION "lib/cmake"
CXX_MODULES_DIRECTORY "cxx-modules"
)
# Always run this custom target by making it depend on ALL
add_custom_target(copy_compile_commands ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json
DEPENDS ${CMAKE_BINARY_DIR}/compile_commands.json
)