Skip to content

Instantly share code, notes, and snippets.

@stevedoyle
Created June 14, 2025 17:15
Show Gist options
  • Save stevedoyle/48e197504af9a9e69130e5a85773f296 to your computer and use it in GitHub Desktop.
Save stevedoyle/48e197504af9a9e69130e5a85773f296 to your computer and use it in GitHub Desktop.
Basic CMakeLists.txt file with a basic project directory.
# Basic CMakeLists.txt file with a basic project directory.
# project_dir
# |
# |-- include
# |-- src
#
cmake_minimum_required(VERSION 3.15)
project(MyProject)
set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/src")
set(SOURCES "${SRC_DIR}/main.cpp" "${SRC_DIR}/file1.cpp" "${SRC_DIR}/file2.cpp")
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include")
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment