mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Add option to enable slog logging in CMake configuration
This commit is contained in:
@@ -35,6 +35,9 @@ ENDIF(APPLE)
|
||||
|
||||
project(libaaruformat C)
|
||||
|
||||
# Option to enable slog logging (disabled by default)
|
||||
option(USE_SLOG "Enable slog logging" OFF)
|
||||
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS=1)
|
||||
|
||||
if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" AND "${CMAKE_C_COMPILER_ARCHITECTURE_ID}" MATCHES "ARMV7")
|
||||
@@ -200,16 +203,24 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
if(POLICY CMP0000)
|
||||
cmake_policy(VERSION 3.5)
|
||||
endif()
|
||||
add_subdirectory(3rdparty/slog)
|
||||
|
||||
# Conditionally enable slog logging
|
||||
if(USE_SLOG)
|
||||
add_subdirectory(3rdparty/slog)
|
||||
|
||||
# Include slog headers
|
||||
include_directories(aaruformat 3rdparty/slog/src)
|
||||
|
||||
# Enable TRACE and slog output
|
||||
add_compile_definitions(aaruformat ENABLE_TRACE ENABLE_FATAL USE_SLOG)
|
||||
|
||||
message(STATUS "slog logging enabled")
|
||||
else()
|
||||
message(STATUS "slog logging disabled (enable with -DUSE_SLOG=ON)")
|
||||
endif()
|
||||
|
||||
include_directories(include 3rdparty/uthash/src)
|
||||
|
||||
# Include slog headers
|
||||
include_directories(aaruformat 3rdparty/slog/src)
|
||||
|
||||
# Enable TRACE and slog output
|
||||
add_compile_definitions(aaruformat ENABLE_TRACE USE_SLOG)
|
||||
|
||||
include(CheckLibraryExists)
|
||||
|
||||
check_library_exists(m log "" HAVE_LIB_M)
|
||||
@@ -217,8 +228,10 @@ if(HAVE_LIB_M)
|
||||
TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE(aaruformat m)
|
||||
endif()
|
||||
|
||||
# Link slog
|
||||
target_link_libraries(aaruformat slog)
|
||||
# Link slog conditionally
|
||||
if(USE_SLOG)
|
||||
target_link_libraries(aaruformat slog)
|
||||
endif()
|
||||
|
||||
# Find Doxygen for documentation generation
|
||||
find_package(Doxygen)
|
||||
|
||||
Reference in New Issue
Block a user