-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
41 lines (31 loc) · 1.17 KB
/
CMakeLists.txt
File metadata and controls
41 lines (31 loc) · 1.17 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
cmake_minimum_required(VERSION 3.18)
project(opengl-cpp-starter LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(EXECUTABLE_NAME starter)
include(fetch_glfw)
include(fetch_glad)
include(fetch_glm)
include(fetch_stb_image)
add_executable(${EXECUTABLE_NAME})
target_sources(${EXECUTABLE_NAME} PRIVATE src/main.cpp src/utils.cpp)
target_include_directories(${EXECUTABLE_NAME} PUBLIC include)
target_link_libraries(${EXECUTABLE_NAME} PUBLIC glfw glad glm stb_image)
option(USE_ASSIMP "Determines whether to fetch and build assimp as part of the project." OFF)
if(USE_ASSIMP)
include(fetch_assimp)
target_link_libraries(${EXECUTABLE_NAME} PUBLIC assimp)
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES)
if(CMAKE_EXPORT_COMPILE_COMMANDS)
# Copy compile_commands.json to root folder (useful when using code completion tools
# such as clangd).
add_custom_command(
TARGET ${EXECUTABLE_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
${CMAKE_CURRENT_SOURCE_DIR})
endif()