-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (39 loc) · 1.36 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
cmake_minimum_required(VERSION 3.7)
# Solution Name
project(BMP-Compressor)
# C++ Version
set(CMAKE_CXX_STANDARD 14)
# Set CMake modules path
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
# Turn on the ability to create folders to organize projects (.vcproj)
# It creates "CMakePredefinedTargets" folder by default and adds CMake
# defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Set SDL2 root path
# set(SDL2_PATH "")
# Set SDL2 Path
if (NOT SDL2_PATH)
SET(SDL2_PATH "" CACHE STRING "Path to SDL2 root.")
endif ()
# Find SDL2
find_package(SDL2 REQUIRED)
IF(SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
endif()
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
# Include Directories
include_directories(include)
# Add files
file(GLOB_RECURSE HEADERS "include/*.h")
file(GLOB_RECURSE SOURCES "source/*.cpp")
# Create named folders for the sources within the .vcproj
# Empty name lists them directly under the .vcproj
source_group("include" FILES ${HEADERS})
source_group("source" FILES ${SOURCES})
# Create .exe
add_executable(BMP-Compressor ${HEADERS} ${SOURCES})
# Link libraries
target_link_libraries(BMP-Compressor ${SDL2_LIBRARY})