From c6a657e7d8135da3a7625b1dd3509a04d348cb4f Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 24 Nov 2024 16:00:22 +0800 Subject: [PATCH] update --- .gitignore | 3 +++ CMakeLists.txt | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 CMakeLists.txt diff --git a/.gitignore b/.gitignore index e257658..611da3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +/build +/*.txt +!/CMakeLists.txt # ---> C++ # Prerequisites *.d diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..ca077f3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.10) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +add_compile_options(-Wall) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) +endif() + +message("Build type is [${CMAKE_BUILD_TYPE}]") + + +project(algorithm2024cpp17) + +include_directories(${CMAKE_CURRENT_LIST_DIR}/src/include) + +file(GLOB_RECURSE SRC_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp) + +foreach(SRC IN LISTS SRC_LIST) + get_filename_component(SRC_NAME_WE ${SRC} NAME_WE) + message("[${SRC}] will be build to [${SRC_NAME_WE}]") + add_executable(${SRC_NAME_WE} ${SRC}) +endforeach()