-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
49 lines (39 loc) · 1.56 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
cmake_minimum_required(VERSION 3.0)
project(grid_diagrams)
# based largely on:
# https://github.com/Polytonic/Glitter/blob/master/CMakeLists.txt
# turn off compiler warnings
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
endif()
# setup GLFW CMake project
add_subdirectory("${PROJECT_SOURCE_DIR}/external/glfw")
# include headers
include_directories("${PROJECT_SOURCE_DIR}/include")
include_directories("${PROJECT_SOURCE_DIR}/external/glfw/include/GLFW")
include_directories("${PROJECT_SOURCE_DIR}/external/imgui/include")
include_directories("${PROJECT_SOURCE_DIR}/external/glad/include")
include_directories("${PROJECT_SOURCE_DIR}/external/glm/glm")
file(GLOB PROJECT_HEADERS "include/*.h")
# include source files
file(GLOB PROJECT_SOURCES "src/*.cpp")
file(GLOB IMGUI_SOURCES "external/imgui/src/*.cpp")
file(GLOB GLAD_SOURCES "external/glad/src/*.c")
# group files in IDE
source_group("include" FILES ${PROJECT_HEADERS})
source_group("src" FILES ${PROJECT_SOURCES})
source_group("external" FILES ${IMGUI_SOURCES} ${GLAD_SOURCES})
# create the executable
add_executable(grid_diagrams ${PROJECT_SOURCES}
${PROJECT_HEADERS} # if not included here, it won't show up in the IDE?
${IMGUI_SOURCES}
${GLAD_SOURCES})
# add libraries
target_link_libraries(grid_diagrams glfw ${GLFW_LIBRARIES})
# force C++17
set_target_properties(grid_diagrams PROPERTIES CXX_STANDARD 17)
if(MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT grid_diagrams)
endif()