Skip to content

Commit e34bb22

Browse files
committed
chore: refactor CMake configuration to be more modular
1 parent b995a1d commit e34bb22

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

CMakeLists.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,8 @@ project(
77
LANGUAGES CXX
88
)
99

10-
set(CMAKE_CXX_STANDARD 20)
11-
12-
if (WIN32) # Install dlls in the same directory as the executable on Windows
13-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
14-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
15-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
16-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
17-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
18-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
19-
endif ()
20-
21-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
22-
set(CMAKE_CXX_FLAGS_DEBUG "/MDd")
23-
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
24-
else ()
25-
set(CMAKE_CXX_FLAGS_DEBUG "-g")
26-
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
27-
endif ()
10+
include(cmake/SetCompilerOptions.cmake)
11+
include(cmake/IncludeExternalLibraries.cmake)
2812

2913
add_subdirectory(lib)
3014
add_subdirectory(bin)

bin/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
add_executable(${PROJECT_NAME} main.cpp)
22

3-
if (NOT CMAKE_BUILD_TYPE)
4-
set(CMAKE_BUILD_TYPE Release) # Main executable should be built with Release
5-
endif ()
6-
7-
message(STATUS "Main executable build type: ${CMAKE_BUILD_TYPE}")
8-
93
target_link_libraries(${PROJECT_NAME} PUBLIC
104
ui
115
)

lib/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
cmake_minimum_required(VERSION 3.12)
22

3-
if (NOT CMAKE_BUILD_TYPE)
4-
set(CMAKE_BUILD_TYPE Debug) # Change this to Release when you're ready to release
5-
endif ()
6-
7-
message(STATUS "Libraries build type: ${CMAKE_BUILD_TYPE}")
8-
93
add_subdirectory(mylib)
104
add_subdirectory(ui)

0 commit comments

Comments
 (0)