Skip to content

Commit 7496d17

Browse files
committed
Enhance CMake configuration by adding utility functions and improving project structure
1 parent 9ad737f commit 7496d17

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
cmake_minimum_required(VERSION 3.31)
2-
project(chip8cpp)
2+
3+
##########################################
34

45
set(CMAKE_CXX_STANDARD 23)
5-
set(CMAKE_CXX_STANDARD_REQUIRED true)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
##########################################
9+
10+
project(chip8cpp)
11+
12+
##########################################
13+
14+
include(cmake/utils.cmake)
15+
16+
##########################################
617

7-
# set the output directory for built objects.
8-
# This makes sure that the dynamic library goes into the build directory automatically.
918
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
1019
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
1120

12-
add_subdirectory(deps/sdl EXCLUDE_FROM_ALL)
21+
##########################################
22+
23+
add_subdirectory(deps)
1324
add_subdirectory(src)

cmake/utils.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include_guard()
2+
3+
##########################################
4+
5+
function(silence_deprecation_warnings)
6+
set(CMAKE_WARN_DEPRECATED_OLD ${CMAKE_WARN_DEPRECATED} PARENT_SCOPE)
7+
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
8+
endfunction()
9+
10+
##########################################
11+
12+
function(restore_deprecation_warnings)
13+
set(CMAKE_WARN_DEPRECATED ${CMAKE_WARN_DEPRECATED_OLD} CACHE BOOL "" FORCE)
14+
endfunction()
15+
16+
##########################################

deps/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
silence_deprecation_warnings()
2+
3+
##########################################
4+
5+
add_subdirectory(sdl EXCLUDE_FROM_ALL)
6+
7+
##########################################
8+
9+
restore_deprecation_warnings()

0 commit comments

Comments
 (0)