Loading cmake/Findjson-c.cmake +23 −19 Changes for cmake/Findjson-c.cmake: 23 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -13,29 +13,26 @@ find_path(JSONC_INCLUDE_DIR PATH_SUFFIXES include ) # KORREKTUR: Findet die json-c library (die auf Windows üblicherweise "json-c.lib" heißt) # Find out the path to the library find_library(JSONC_LIBRARY NAMES json-c NAMES hiredis ) # ----------------------------------------------------------------------------- # 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. Check your CMAKE_PREFIX_PATH." FAIL_MESSAGE "Could NOT find json-c shared library or headers." ) # ----------------------------------------------------------------------------- # 3. Define Imported Shared Target (Internal Name) # ----------------------------------------------------------------------------- # 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 @@ -46,26 +43,25 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) INTERFACE_INCLUDE_DIRECTORIES "${JSONC_INCLUDE_DIR}" ) # 3. Set the imported library file (the .lib on Windows) # 3. Set the location properties if(WIN32) # Set IMPORTED_IMPLIB (the .lib) for linking set_target_properties(JsonC::JsonC PROPERTIES IMPORTED_IMPLIB_RELEASE "${JSONC_LIBRARY}" IMPORTED_IMPLIB_DEBUG "${JSONC_LIBRARY}" IMPORTED_IMPLIB "${JSONC_LIBRARY}" ) # 4. Set the runtime location (the .dll on Windows) if(WIN32) # JSONC_LIBRARY enthält den Pfad zur .lib-Datei (z.B. C:/.../install/lib/json-c.lib) # CRITICAL FOR DLL PATH RESOLUTION: Determine the DLL path. get_filename_component(_LIB_DIR "${JSONC_LIBRARY}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Dies sollte C:/.../install sein get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Determine the DLL name (z.B. aus 'json-c.lib' wird 'json-c') # Determine the DLL name get_filename_component(_LIB_NAME_WE "${JSONC_LIBRARY}" NAME_WE) string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Entfernt optional 'lib' Präfix string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Set IMPORTED_LOCATION for configurations (Annahme: DLLs liegen in /bin) # Set IMPORTED_LOCATION for configurations 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" # Annahme für Debug-DLL IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" IMPORTED_LOCATION_RELWITHDEBINFO "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" ) Loading @@ -77,8 +73,16 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) endif() # ----------------------------------------------------------------------------- # 4. Define Alias for Consumer (Der Konsument sucht nach "json-c::json-c") # 4. Define Alias for Consumer (Fixes the json-c::json-c-NOTFOUND error) # ----------------------------------------------------------------------------- # Erstelle einen ALIAS Target, der auf das primäre Target JsonC::JsonC zeigt. # 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() # Hide internal variables from the CMake GUI mark_as_advanced( JSONC_INCLUDE_DIR JSONC_LIBRARY ) No newline at end of file Loading
cmake/Findjson-c.cmake +23 −19 Changes for cmake/Findjson-c.cmake: 23 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -13,29 +13,26 @@ find_path(JSONC_INCLUDE_DIR PATH_SUFFIXES include ) # KORREKTUR: Findet die json-c library (die auf Windows üblicherweise "json-c.lib" heißt) # Find out the path to the library find_library(JSONC_LIBRARY NAMES json-c NAMES hiredis ) # ----------------------------------------------------------------------------- # 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. Check your CMAKE_PREFIX_PATH." FAIL_MESSAGE "Could NOT find json-c shared library or headers." ) # ----------------------------------------------------------------------------- # 3. Define Imported Shared Target (Internal Name) # ----------------------------------------------------------------------------- # 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 @@ -46,26 +43,25 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) INTERFACE_INCLUDE_DIRECTORIES "${JSONC_INCLUDE_DIR}" ) # 3. Set the imported library file (the .lib on Windows) # 3. Set the location properties if(WIN32) # Set IMPORTED_IMPLIB (the .lib) for linking set_target_properties(JsonC::JsonC PROPERTIES IMPORTED_IMPLIB_RELEASE "${JSONC_LIBRARY}" IMPORTED_IMPLIB_DEBUG "${JSONC_LIBRARY}" IMPORTED_IMPLIB "${JSONC_LIBRARY}" ) # 4. Set the runtime location (the .dll on Windows) if(WIN32) # JSONC_LIBRARY enthält den Pfad zur .lib-Datei (z.B. C:/.../install/lib/json-c.lib) # CRITICAL FOR DLL PATH RESOLUTION: Determine the DLL path. get_filename_component(_LIB_DIR "${JSONC_LIBRARY}" DIRECTORY) get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Dies sollte C:/.../install sein get_filename_component(_PARENT_DIR "${_LIB_DIR}" DIRECTORY) # Determine the DLL name (z.B. aus 'json-c.lib' wird 'json-c') # Determine the DLL name get_filename_component(_LIB_NAME_WE "${JSONC_LIBRARY}" NAME_WE) string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Entfernt optional 'lib' Präfix string(REGEX REPLACE "^lib" "" _DLL_NAME_BASE "${_LIB_NAME_WE}") # Set IMPORTED_LOCATION for configurations (Annahme: DLLs liegen in /bin) # Set IMPORTED_LOCATION for configurations 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" # Annahme für Debug-DLL IMPORTED_LOCATION_DEBUG "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}d.dll" IMPORTED_LOCATION_RELWITHDEBINFO "${_PARENT_DIR}/bin/${_DLL_NAME_BASE}.dll" ) Loading @@ -77,8 +73,16 @@ if(JSONC_FOUND AND NOT TARGET JsonC::JsonC) endif() # ----------------------------------------------------------------------------- # 4. Define Alias for Consumer (Der Konsument sucht nach "json-c::json-c") # 4. Define Alias for Consumer (Fixes the json-c::json-c-NOTFOUND error) # ----------------------------------------------------------------------------- # Erstelle einen ALIAS Target, der auf das primäre Target JsonC::JsonC zeigt. # 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() # Hide internal variables from the CMake GUI mark_as_advanced( JSONC_INCLUDE_DIR JSONC_LIBRARY ) No newline at end of file