Skip to content

Instantly share code, notes, and snippets.

@stevedoyle
Created June 14, 2025 17:15
Show Gist options
  • Save stevedoyle/44f860e3275fef261f050930b92fc668 to your computer and use it in GitHub Desktop.
Save stevedoyle/44f860e3275fef261f050930b92fc668 to your computer and use it in GitHub Desktop.
Minimal CMakeLists.txt file with all source files in the same directory as the CMakeLists.txt file. #
# Minimal CMakeLists.txt file with all source files in the same directory as the CMakeLists.txt file.
#
cmake_minimum_required(VERSION 3.15)
project(MyProject)
set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(SOURCES "${SRC_DIR}/main.cpp" "${SRC_DIR}/file1.cpp" "${SRC_DIR}/file2.cpp")
add_executable(${PROJECT_NAME} ${SOURCES})
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