-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
28 lines (21 loc) · 753 Bytes
/
Copy pathCMakeLists.txt
File metadata and controls
28 lines (21 loc) · 753 Bytes
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
cmake_minimum_required(VERSION 3.15)
# 2. Project Name and Details
project(my_app
VERSION 1.0
DESCRIPTION "A standard C++ project"
LANGUAGES C CXX
)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
# 3. C++ Standard Settings
set(CMAKE_CXX_STANDARD 17) # Use C++17
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Error if C++17 is not available
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generates compile_commands.json (useful for VSCode/Clangd)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Configuring for DEBUG: Optimizations disabled.")
add_compile_options(-g -O0)
endif()
file(GLOB SOURCES "src/*.cpp" "src/*.c")
add_executable(my_app ${SOURCES})