Commit 682d5037 authored by jan.koester's avatar jan.koester
Browse files

test

parent 1131f829
Loading
Loading
Loading
Loading
+11 −15
Changes for cmake/Findjson-c.cmake: 11 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -13,9 +13,9 @@ find_path(JSONC_INCLUDE_DIR
	PATH_SUFFIXES include
)

# Find out the path to the library
# Find out the path to the library (Korrigiert von hiredis zu json-c)
find_library(JSONC_LIBRARY
	NAMES hiredis
	NAMES json-c
)

# -----------------------------------------------------------------------------
@@ -33,7 +33,9 @@ find_package_handle_standard_args(JsonC
# 3. Define Imported Shared Target (Internal Name)
# -----------------------------------------------------------------------------

if(JSONC_FOUND)
# WICHTIGE KORREKTUR: Prüfe, ob das Target bereits existiert, um Fehler bei
# mehrfachem find_package(JsonC) zu verhindern.
if(JSONC_FOUND AND NOT TARGET JsonC::JsonC)
    
    # 1. Define the primary target with the name 'JsonC::JsonC'
    add_library(JsonC::JsonC SHARED IMPORTED)
@@ -43,14 +45,15 @@ if(JSONC_FOUND)
        INTERFACE_INCLUDE_DIRECTORIES "${JSONC_INCLUDE_DIR}"
    )

    # 3. Set the location properties
    if(WIN32)
        # Set IMPORTED_IMPLIB (the .lib) for linking
    # 3. Set the imported library file (the .lib on Windows)
    set_target_properties(JsonC::JsonC PROPERTIES
            IMPORTED_IMPLIB "${JSONC_LIBRARY}"
        IMPORTED_IMPLIB_RELEASE "${JSONC_LIBRARY}"
        IMPORTED_IMPLIB_DEBUG "${JSONC_LIBRARY}"
    )

        # CRITICAL FOR DLL PATH RESOLUTION: Determine the DLL path.
    # 4. Set the runtime location (the .dll on Windows)
    if(WIN32)
        # Assuming JSONC_LIBRARY found the .lib file in /lib.
        get_filename_component(_LIB_DIR "${JSONC_LIBRARY}" DIRECTORY)
        get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY)
        
@@ -78,11 +81,4 @@ if(JSONC_FOUND)
    # The consumer (src/authdb.exe) is looking for json-c::json-c (lowercase).
    # Create an ALIAS target pointing to the primary target JsonC::JsonC.
    add_library(json-c::json-c ALIAS JsonC::JsonC)
    
endif()
 No newline at end of file

# Hide internal variables from the CMake GUI
mark_as_advanced(
    JSONC_INCLUDE_DIR
    JSONC_LIBRARY
)
 No newline at end of file