From 3fae66d1f3fd3d07a1cc7a99242cfc5f9e29ed4d Mon Sep 17 00:00:00 2001 From: Ian Duncan <76043277+dr8co@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:53:17 +0300 Subject: [PATCH] Refactor sources listing in CMakeLists Moved the detailed listing of source files from src/CMakeLists.txt to main CMakeLists.txt using file(GLOB_RECURSE). This change aims to simplify the source management as it will automatically include any newly added .cpp or .hpp file, preventing the need to manually add each newly created source file into the src/CMakeLists.txt. --- CMakeLists.txt | 8 +++++++- src/CMakeLists.txt | 22 ---------------------- 2 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a05fd6..3026cab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,13 @@ find_package(BLAKE3 REQUIRED) # See https://github.com/BLAKE3-team/BLAKE3 # Add the executable target add_executable(privacyShield) -add_subdirectory(src) + +# Add sources for the target +file(GLOB_RECURSE PRIVACY_SHIELD_SOURCES + "${CMAKE_SOURCE_DIR}/src/*.cpp" + "${CMAKE_SOURCE_DIR}/src/*.hpp") + +target_sources(privacyShield PRIVATE ${PRIVACY_SHIELD_SOURCES}) # Link dependencies target_link_libraries(privacyShield diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 14e3ed8..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.25) - -# Add sources for the target -target_sources(privacyShield - PRIVATE main.cpp - PRIVATE duplicateFinder/duplicateFinder.hpp - PRIVATE duplicateFinder/duplicateFinder.cpp - PRIVATE encryption/encryptDecryptFiles.cpp - PRIVATE encryption/encryptDecryptStrings.cpp - PRIVATE encryption/encryptDecrypt.cpp - PRIVATE encryption/encryptDecrypt.hpp - PRIVATE fileShredder/shredFiles.hpp - PRIVATE fileShredder/shredFiles.cpp - PRIVATE passwordManager/passwordManager.cpp - PRIVATE passwordManager/FuzzyMatcher.hpp - PRIVATE passwordManager/passwords.hpp - PRIVATE passwordManager/passwords.cpp - PRIVATE privacyTracks/privacyTracks.hpp - PRIVATE privacyTracks/privacyTracks.cpp - PRIVATE utils/utils.cpp - PRIVATE utils/utils.hpp - PRIVATE secureAllocator.hpp)