From 478a7cd0a6fedad4c2e70c4b1fd5c466738ec339 Mon Sep 17 00:00:00 2001 From: jake-g00dwin Date: Sat, 20 Dec 2025 19:32:56 -0800 Subject: [PATCH] Updated cmake config for modules in template dir + Added regedit by default. + Added comments for detials. + Reconfigured with unit testing logic. --- .template_files/modules/CMakeLists.txt | 34 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.template_files/modules/CMakeLists.txt b/.template_files/modules/CMakeLists.txt index b27bc02..0bdbda9 100644 --- a/.template_files/modules/CMakeLists.txt +++ b/.template_files/modules/CMakeLists.txt @@ -1,7 +1,35 @@ +# File: src/module_name/CMakeLists.txt add_library(module_name STATIC module_name.c ) -target_include_directories(module_name PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) +# Current list dir: The directory where the cmake config file is. +# Source Dir: The dir where the root/main cmake config file is. + +if(NOT UNIT_TESTING) + target_include_directories(module_name PUBLIC + ${CMAKE_CURRENT_LIST_DIR} + ${CMAKE_SOURCE_DIR}/inc/ + ) + target_link_libraries(module_name + RegEdit + ) +else() + target_include_directories(module_name PUBLIC + ${CMAKE_CURRENT_LIST_DIR} + #First we include any module specific test dependencies. + ${CMAKE_SOURCE_DIR}/tests/module_name/mocks/ + ${CMAKE_SOURCE_DIR}/tests/module_name/fakes/ + ${CMAKE_SOURCE_DIR}/tests/module_name/stubs/ + #Next comes the shared and non-module specific test depencencies. + ${CMAKE_SOURCE_DIR}/tests/shared/mocks/ + ${CMAKE_SOURCE_DIR}/tests/shared/fakes/ + ${CMAKE_SOURCE_DIR}/tests/shared/stubs/ + #Finally we include the local stuff, which has likely been overridden. + ${CMAKE_CURRENT_SOURCE_DIR} + ) + #Place Mocked/Regular dependencies here for unit testing. + target_link_libraries(module_name + MockRegEdit + ) +endif()