cmake_minimum_required(VERSION 3.15) project(ParseLogCLI LANGUAGES CXX) # System and compiler configurations set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # ========================================== # 1. CORE LIBRARY TARGET # ========================================== # Compiles your core logic files into a shared library module add_library(parselog_core log_parsing/log_parsing.cpp ip_to_geo/ip_to_geo.cpp third_party/src/GeoLite2PP.cpp third_party/src/GeoLite2PP_error_category.cpp ) # Include paths for your modules and MaxMind headers target_include_directories(parselog_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/log_parsing ${CMAKE_CURRENT_SOURCE_DIR}/ip_to_geo ${CMAKE_CURRENT_SOURCE_DIR}/third_party/include ) # Link the static third-party MaxMind binary target_link_libraries(parselog_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a ) # Version definitions needed by your GeoLite2PP wrapper target_compile_definitions(parselog_core PRIVATE GEOLITE2PP_VERSION="0.0.1" ) # ========================================== # 2. APPLICATION EXECUTABLE # ========================================== # Compiles your main user-facing CLI binary add_executable(parselog_cli main.cpp) target_link_libraries(parselog_cli PRIVATE parselog_core) set_target_properties(parselog_cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) # ========================================== # 3. TEST SUITE # ========================================== # Activates the built-in CTest engine enable_testing() # add_executable(parselog_test tests.cpp) # target_link_libraries(parselog_test PRIVATE parselog_core) # Registers the testing executable under the "RunAllTests" banner # add_test(NAME RunAllTests COMMAND parselog_test)