-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (36 loc) · 1.29 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
cmake_minimum_required(VERSION 3.15)
# Project name and version
project(Fly VERSION 1.0)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Add source files
file(GLOB_RECURSE SOURCES "src/*.cpp")
file(GLOB_RECURSE HEADERS "src/*.h")
# Add executable
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE src)
# Set precompiled header
target_precompile_headers(${PROJECT_NAME} PRIVATE src/pch.h)
# Add submodules
add_subdirectory(external/imgui)
add_subdirectory(external/openal-soft)
add_subdirectory(external/libsndfile)
add_subdirectory(external/hello-imgui)
# Link libraries
find_package(OpenAL REQUIRED)
find_package(SndFile REQUIRED)
find_package(ImGui REQUIRED)
find_package(HelloImGui REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL sndfile ImGui::ImGui HelloImGui::HelloImGui)
# Set configurations
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release
)
# Post-build commands
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/res $<TARGET_FILE_DIR:${PROJECT_NAME}>
)