44cmake_minimum_required (VERSION 3.15)
55
66# Define the project name, version (optional), and language
7- project (Myrmidon VERSION 1.0 LANGUAGES CXX) # <--- CHANGED
7+ project (Myrmidon VERSION 1.0 LANGUAGES CXX)
88
99# --- Set C++ Standard (Globally or Per-Target) ---
1010# Require C++17
@@ -20,6 +20,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
2020# Explicitly list files for robustness instead of using GLOB
2121set (ENGINE_SOURCES
2222 src/base_fact.cpp
23+ src/core/rule.cpp
2324 # src/pattern.cpp
2425 # src/constraint.cpp
2526 # src/rule.cpp
@@ -37,10 +38,14 @@ add_library(RuleEngineCore STATIC ${ENGINE_SOURCES}) # Or SHARED
3738# PRIVATE: Only RuleEngineCore needs this path during its own compilation
3839target_include_directories (RuleEngineCore
3940 PUBLIC
40- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include > # Headers for consumers
41- $<INSTALL_INTERFACE:include > # Headers for consumers when installed (adjust path)
41+ # Expose the 'include' directory for linking targets
42+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
43+ # Define where headers will be installed (relative to CMAKE_INSTALL_PREFIX/include)
44+ $<INSTALL_INTERFACE:include >
4245 PRIVATE
43- ${CMAKE_CURRENT_SOURCE_DIR} /src # If headers are alongside sources or private headers exist
46+ # Internal include paths needed only by RuleEngineCore itself
47+ ${CMAKE_CURRENT_SOURCE_DIR} /src
48+ ${CMAKE_CURRENT_SOURCE_DIR} /src/core
4449)
4550
4651# --- Define Example Executable Using the Engine ---
@@ -50,6 +55,7 @@ target_include_directories(RuleEngineCore
5055add_executable (RuleEngineApp src/main.cpp)
5156
5257# Link the executable against the core engine library
58+ # RuleEngineApp inherits PUBLIC include directories from RuleEngineCore
5359target_link_libraries (RuleEngineApp PRIVATE RuleEngineCore)
5460
5561# --- Optional: Link External Libraries (Example) ---
@@ -68,9 +74,20 @@ find_package(GTest REQUIRED)
6874# (Target name RuleEngineTests is okay, or change to MyrmidonTests if preferred)
6975add_executable (RuleEngineTests
7076 tests/test_base_fact.cpp
77+ tests/core/test_rule.cpp
7178 # Add other test source files here as you create them
7279)
7380
81+ # Add include directories needed specifically by the test executable
82+ # This comes AFTER add_executable(RuleEngineTests ...)
83+ target_include_directories (RuleEngineTests PRIVATE
84+ # It needs the public headers (could rely on inheritance, but explicit is fine)
85+ ${CMAKE_CURRENT_SOURCE_DIR} /include
86+ # CRITICAL: It needs internal headers not inherited via linking
87+ ${CMAKE_CURRENT_SOURCE_DIR} /src/core
88+ # Add ${CMAKE_CURRENT_SOURCE_DIR}/src if other internal headers are needed
89+ )
90+
7491# Link the test executable against your core library and GoogleTest
7592target_link_libraries (RuleEngineTests PRIVATE
7693 RuleEngineCore # Link against the library being tested
@@ -85,4 +102,4 @@ include(GoogleTest)
85102gtest_discover_tests(RuleEngineTests)
86103
87104# --- Optional: Add test that runs the main executable (if it exists) ---
88- # add_test(NAME BasicRunTest COMMAND RuleEngineApp)
105+ # add_test(NAME BasicRunTest COMMAND RuleEngineApp)
0 commit comments