-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (46 loc) · 2.21 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
set(PROGRAM_NAME BCG-PROJECT)
project(BCG-PROJECT)
###################################################################################################
set(CMAKE_CXX_FLAGS "-Wall -g -pedantic")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_COLOR_MAKEFILE True)
###################################################################################################
add_subdirectory(${PROJECT_SOURCE_DIR}/include)
file(GLOB_RECURSE SOURCES src/*.cpp)
###################################################################################################
# SFML
set(SFML_DIR "${PROJECT_SOURCE_DIR}/libs/SFML/lib/cmake/SFML") #firstly we are searching for SFML in our dir tree
set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2.5 COMPONENTS system window graphics QUIET)
if(NOT SFML_FOUND) #if SFML wasnt found then we search in config
include("config.cmake")
find_package(SFML 2.5 COMPONENTS system window graphics REQUIRED QUIET)
set(FOUND_WITH_CONFIG True)
else()
set(FOUND_IN_PROJECT_TREE True)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") #for compatibility with linux os
set(LIBS "opengl32" "comdlg32" "ole32")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LIBS "GL")
endif()
if(FOUND_IN_PROJECT_TREE)
message(STATUS "[INFO] SFML found in project tree!")
elseif(FOUND_WITH_CONFIG)
message(STATUS "[INFO] SFML found with config file in ${SFML_DIR}")
else()
message(STATUS "[INFO] SFML was not found, aborting...")
endif()
###################################################################################################
# tinyfiledialogs
include_directories("${PROJECT_SOURCE_DIR}/dep/tinyfiledialogs")
list(APPEND SOURCES "${PROJECT_SOURCE_DIR}/dep/tinyfiledialogs/tinyfiledialogs.cpp")
###################################################################################################
if(SFML_FOUND)
add_executable(${PROGRAM_NAME} ${SOURCES} main.cpp)
target_link_libraries(${PROGRAM_NAME} PUBLIC sfml-system sfml-window sfml-graphics ${LIBS})
target_precompile_headers(${PROGRAM_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include/root/Root.h")
endif()
###################################################################################################