From afd71cacbf324b2898220437c10b4db4228b70ce Mon Sep 17 00:00:00 2001 From: hybrid Date: Fri, 21 Aug 2026 17:26:49 +0300 Subject: add: alot --- CMakeLists.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CMakeLists.txt (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..eea0bfc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 4.3.4) +project(LearnCPP) + +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# where to put binaries +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# find all .cpp files inside src directory +file(GLOB_RECURSE SOURCES "src/*.cpp") + +foreach(SOURCE_FILE ${SOURCES}) + # get paths + file(RELATIVE_PATH REL_PATH ${CMAKE_SOURCE_DIR}/src ${SOURCE_FILE}) + + # form target names (substitute '/' to '_', remove '.cpp') + string(REPLACE "/" "_" TARGET_NAME ${REL_PATH}) + string(REPLACE ".cpp" "" TARGET_NAME ${TARGET_NAME}) + + add_executable(${TARGET_NAME} ${SOURCE_FILE}) + target_compile_options(${TARGET_NAME} PRIVATE + -Wall -Weffc++ -Wextra -Wpedantic + ) + + # link libs here +endforeach() -- cgit v1.3.1