Loading cmake/Findjson-c.cmake +13 −13 Changes for cmake/Findjson-c.cmake: 13 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ find_path(JSONC_INCLUDE_DIR PATH_SUFFIXES include ) # Find out the path to the library (Korrigiert von hiredis zu json-c) # KORREKTUR: Findet die json-c library (die auf Windows üblicherweise "json-c.lib" heißt) find_library(JSONC_LIBRARY NAMES json-c ) Loading @@ -22,19 +22,20 @@ find_library(JSONC_LIBRARY # 2. Handle Required Arguments # ----------------------------------------------------------------------------- # Dies setzt JSONC_FOUND auf TRUE, wenn beide Variablen gefunden wurden. find_package_handle_standard_args(JsonC FOUND_VAR JSONC_FOUND REQUIRED_VARS JSONC_INCLUDE_DIR JSONC_LIBRARY FAIL_MESSAGE "Could NOT find json-c shared library or headers." FAIL_MESSAGE "Could NOT find json-c shared library or headers. Check your CMAKE_PREFIX_PATH." ) # ----------------------------------------------------------------------------- # 3. Define Imported Shared Target (Internal Name) # ----------------------------------------------------------------------------- # WICHTIGE KORREKTUR: Prüfe, ob das Target bereits existiert, um Fehler bei # mehrfachem find_package(JsonC) zu verhindern. # KORREKTUR: Führe die Target-Definition nur aus, wenn die Bibliothek tatsächlich gefunden wurde # und das Target nicht bereits definiert ist (um den vorherigen Fehler zu vermeiden). if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) # 1. Define the primary target with the name 'JsonC::JsonC' Loading @@ -53,18 +54,18 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) # 4. Set the runtime location (the .dll on Windows) if(WIN32) # Assuming JSONC_LIBRARY found the .lib file in /lib. # JSONC_LIBRARY enthält den Pfad zur .lib-Datei (z.B. C:/.../install/lib/json-c.lib) get_filename_component(_LIB_DIR "${JSONC_LIBRARY}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Dies sollte C:/.../install sein # Determine the DLL name # Determine the DLL name (z.B. aus 'json-c.lib' wird 'json-c') get_filename_component(_LIB_NAME_WE "${JSONC_LIBRARY}" NAME_WE) string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Entfernt optional 'lib' Präfix # Set IMPORTED_LOCATION for configurations # Set IMPORTED_LOCATION for configurations (Annahme: DLLs liegen in /bin) set_target_properties(JsonC::JsonC PROPERTIES IMPORTED_LOCATION_RELEASE "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" # Annahme für Debug-DLL IMPORTED_LOCATION_RELWITHDEBINFO "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" ) Loading @@ -76,9 +77,8 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) endif() # ----------------------------------------------------------------------------- # 4. Define Alias for Consumer (Fixes the json-c::json-c-NOTFOUND error) # 4. Define Alias for Consumer (Der Konsument sucht nach "json-c::json-c") # ----------------------------------------------------------------------------- # The consumer (src/authdb.exe) is looking for json-c::json-c (lowercase). # Create an ALIAS target pointing to the primary target JsonC::JsonC. # Erstelle einen ALIAS Target, der auf das primäre Target JsonC::JsonC zeigt. add_library(json-c::json-c ALIAS JsonC::JsonC) endif() No newline at end of file Loading
cmake/Findjson-c.cmake +13 −13 Changes for cmake/Findjson-c.cmake: 13 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ find_path(JSONC_INCLUDE_DIR PATH_SUFFIXES include ) # Find out the path to the library (Korrigiert von hiredis zu json-c) # KORREKTUR: Findet die json-c library (die auf Windows üblicherweise "json-c.lib" heißt) find_library(JSONC_LIBRARY NAMES json-c ) Loading @@ -22,19 +22,20 @@ find_library(JSONC_LIBRARY # 2. Handle Required Arguments # ----------------------------------------------------------------------------- # Dies setzt JSONC_FOUND auf TRUE, wenn beide Variablen gefunden wurden. find_package_handle_standard_args(JsonC FOUND_VAR JSONC_FOUND REQUIRED_VARS JSONC_INCLUDE_DIR JSONC_LIBRARY FAIL_MESSAGE "Could NOT find json-c shared library or headers." FAIL_MESSAGE "Could NOT find json-c shared library or headers. Check your CMAKE_PREFIX_PATH." ) # ----------------------------------------------------------------------------- # 3. Define Imported Shared Target (Internal Name) # ----------------------------------------------------------------------------- # WICHTIGE KORREKTUR: Prüfe, ob das Target bereits existiert, um Fehler bei # mehrfachem find_package(JsonC) zu verhindern. # KORREKTUR: Führe die Target-Definition nur aus, wenn die Bibliothek tatsächlich gefunden wurde # und das Target nicht bereits definiert ist (um den vorherigen Fehler zu vermeiden). if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) # 1. Define the primary target with the name 'JsonC::JsonC' Loading @@ -53,18 +54,18 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) # 4. Set the runtime location (the .dll on Windows) if(WIN32) # Assuming JSONC_LIBRARY found the .lib file in /lib. # JSONC_LIBRARY enthält den Pfad zur .lib-Datei (z.B. C:/.../install/lib/json-c.lib) get_filename_component(_LIB_DIR "${JSONC_LIBRARY}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Dies sollte C:/.../install sein # Determine the DLL name # Determine the DLL name (z.B. aus 'json-c.lib' wird 'json-c') get_filename_component(_LIB_NAME_WE "${JSONC_LIBRARY}" NAME_WE) string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Entfernt optional 'lib' Präfix # Set IMPORTED_LOCATION for configurations # Set IMPORTED_LOCATION for configurations (Annahme: DLLs liegen in /bin) set_target_properties(JsonC::JsonC PROPERTIES IMPORTED_LOCATION_RELEASE "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" # Annahme für Debug-DLL IMPORTED_LOCATION_RELWITHDEBINFO "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" ) Loading @@ -76,9 +77,8 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) endif() # ----------------------------------------------------------------------------- # 4. Define Alias for Consumer (Fixes the json-c::json-c-NOTFOUND error) # 4. Define Alias for Consumer (Der Konsument sucht nach "json-c::json-c") # ----------------------------------------------------------------------------- # The consumer (src/authdb.exe) is looking for json-c::json-c (lowercase). # Create an ALIAS target pointing to the primary target JsonC::JsonC. # Erstelle einen ALIAS Target, der auf das primäre Target JsonC::JsonC zeigt. add_library(json-c::json-c ALIAS JsonC::JsonC) endif() No newline at end of file