Loading backends/CMakeLists.txt +5 −5 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ if(YAML_FOUND) if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") # Ensure 'confplus' is linked as PRIVATE unless its interface is exposed target_link_libraries(yamlconf PRIVATE confplus yaml::yaml kernel32.lib) target_link_libraries(yamlconf PRIVATE confplus yaml kernel32.lib) else() target_link_libraries(yamlconf PRIVATE confplus yaml::yaml dl) target_link_libraries(yamlconf PRIVATE confplus yaml dl) endif() install(TARGETS yamlconf Loading @@ -31,7 +31,7 @@ if(YAML_FOUND) endif() # --- INIPARSER BACKEND (Corrected) --- find_package(INIPARSER) find_package(INIPARSER REQUIRED) if(INIPARSER_FOUND) set( inisrc ini/ini.cpp) Loading @@ -44,9 +44,9 @@ if(INIPARSER_FOUND) # We remove target_include_directories and rely on INIPARSER::INIPARSER. if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_link_libraries(iniconf PRIVATE confplus iniparser::iniparser kernel32.lib) target_link_libraries(iniconf PRIVATE confplus iniparser kernel32.lib) else() target_link_libraries(iniconf PRIVATE confplus iniparser::iniparser dl) target_link_libraries(iniconf PRIVATE confplus iniparser dl) endif() install(TARGETS iniconf Loading cmake/FindINIPARSER.cmake +38 −36 Original line number Diff line number Diff line # FindINIPARSER.cmake # 1. Search for the INIPARSER header file (iniparser.h) find_path(INIPARSER_INCLUDE_DIR NAMES iniparser.h PATHS /usr/local /usr HINTS ENV{INIPARSER_ROOT} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES include ) # 2. Search for the library file (libiniparser.a/lib, iniparser.lib) find_library(INIPARSER_LIBRARY NAMES iniparser libiniparser # Corrected to include libiniparser PATHS /usr/local /usr HINTS ENV{INIPARSER_ROOT} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES lib ) # iniparser-config.cmake # -------------------------------------------------------------------------- # 1. Definieren der Pfadvariablen (Simulieren der Installationslogik) # -------------------------------------------------------------------------- if(DEFINED CMAKE_PREFIX_PATH) list(GET CMAKE_PREFIX_PATH 0 INIPARSER_ROOT) # Nimm den ersten Pfad in der Liste elseif(DEFINED CMAKE_INSTALL_PREFIX) set(INIPARSER_ROOT "${CMAKE_INSTALL_PREFIX}") else() # Fallback zur Berechnung basierend auf dem Speicherort dieser Datei get_filename_component(INIPARSER_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE) endif() # 3. Handle standard arguments (set INIPARSER_FOUND) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(INIPARSER DEFAULT_MSG INIPARSER_LIBRARY INIPARSER_INCLUDE_DIR ) # Setze die Variablen, die von der installierten iniparser erwartet werden # Die Header liegen oft direkt in <prefix>/include set(INIPARSER_INCLUDE_DIR "${INIPARSER_ROOT}/include") set(INIPARSER_LIBRARY_DIR "${INIPARSER_ROOT}/lib") # In your FindINIPARSER.cmake: # -------------------------------------------------------------------------- # 2. Erstellen des Namespaced IMPORTED Targets # -------------------------------------------------------------------------- # 4. Create the modern IMPORTED target (if found) if(INIPARSER_FOUND AND NOT TARGET iniparser::iniparser) # Use lowercase target name # Create the target using the lowercase name add_library(iniparser::iniparser INTERFACE IMPORTED) # Definieren des Targets mit Namensraum (iniparser::iniparser) if (NOT TARGET iniparser::iniparser) # iniparser ist typischerweise eine C-Bibliothek, hier als STATIC importiert add_library(iniparser::iniparser STATIC IMPORTED) set_target_properties(iniparser::iniparser PROPERTIES # Use lowercase target name # --- WICHTIG: Schnittstellen-Include-Pfade definieren --- # Dadurch wird der Header-Pfad automatisch an abhängige Targets weitergegeben. set_target_properties(iniparser::iniparser PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${INIPARSER_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${INIPARSER_LIBRARY}" ) message(STATUS "SUCCESS: Defined modern target iniparser::iniparser.") endif() # --- END CORRECTED LOGIC --- # --- WICHTIG: Speicherorte der Binärdateien definieren --- # Release Konfiguration (Der tatsächliche Link-Name in vcpkg/Installation ist oft 'iniparser-static') set_target_properties(iniparser::iniparser PROPERTIES # Setze den tatsächlichen Speicherort der statischen Bibliothek IMPORTED_LOCATION_RELEASE "${INIPARSER_LIBRARY_DIR}/iniparser-static.lib" ) # 5. Mark variables as advanced mark_as_advanced(INIPARSER_LIBRARY INIPARSER_INCLUDE_DIR) No newline at end of file # Setze INIPARSER_FOUND set(INIPARSER_FOUND TRUE) endif() No newline at end of file cmake/FindYAML.cmake +51 −42 Original line number Diff line number Diff line # CMake module to search for the C library libyaml # # If the library is found, then YAML_FOUND is set to TRUE, # and following variables are set: # YAML_INCLUDE_DIR # YAML_LIBRARIES # 1. Include directory search find_path(YAML_INCLUDE_DIR NAMES yaml.h) # 2. Configure library search for static libraries # Speichern Sie die aktuellen Such-Suffixe set(ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Stellen Sie sicher, dass wir nach den statischen Suffixen suchen if (WIN32) # Unter Windows suchen wir explizit nach .lib (statisch) vor .dll (dynamisch) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) # yaml-config.cmake # -------------------------------------------------------------------------- # 1. Definieren der Pfadvariablen (Simulieren der Installationslogik) # -------------------------------------------------------------------------- # Setze YAML_ROOT basierend auf dem Pfad dieser Datei, um die Installation zu finden # CMAKE_CURRENT_LIST_DIR ist der Ordner, in dem diese Datei liegt. # Gehe zwei Ebenen hoch, um zum Installations-Präfix zu gelangen (z.B. /install/lib/cmake/yaml/ -> /install) if(DEFINED CMAKE_PREFIX_PATH) list(GET CMAKE_PREFIX_PATH 0 YAML_ROOT) # Nimm den ersten Pfad in der Liste elseif(DEFINED CMAKE_INSTALL_PREFIX) set(YAML_ROOT "${CMAKE_INSTALL_PREFIX}") else() # Unter Unix/Linux/macOS ist .a das statische Standard-Suffix set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Fallback zur Berechnung basierend auf dem Speicherort dieser Datei get_filename_component(YAML_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE) endif() # 3. Search for the static library find_library(YAML_LIBRARIES NAMES yaml libyaml) # 4. Set Suffixes back to original set(CMAKE_FIND_LIBRARY_SUFFIXES ${ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES}) # Setze die Variablen, die von der installierten libyaml erwartet werden # Dies sind nur Beispiele; Sie müssen die tatsächlichen Pfade in Ihrer Umgebung prüfen! set(YAML_INCLUDE_DIR "${YAML_ROOT}/include") set(YAML_LIBRARY_DIR "${YAML_ROOT}/lib") # Stellen Sie sicher, dass die Variablen gesetzt sind, bevor Sie sie verwenden set(YAML_FOUND TRUE) # 5. Handle standard arguments include(FindPackageHandleStandardArgs) find_package_handle_standard_args(YAML DEFAULT_MSG YAML_LIBRARIES YAML_INCLUDE_DIR) mark_as_advanced(YAML_INCLUDE_DIR YAML_LIBRARIES) # -------------------------------------------------------------------------- # 2. Erstellen des Namespaced IMPORTED Targets # -------------------------------------------------------------------------- # 6. Create IMPORTED Target for modern CMake usage # WICHTIG: Verwenden Sie 'yaml::yaml', um den Anforderungen von libconfplus zu entsprechen. if (YAML_FOUND AND NOT TARGET yaml::yaml) # Target mit dem korrekten Namen erstellen add_library(yaml::yaml UNKNOWN IMPORTED) # Definieren des Namensraum-Targets, wie in der CMakeLists.txt gewünscht if (NOT TARGET yaml::yaml) # Da es sich um eine C-Bibliothek handelt, definieren wir sie als Shared (DLL/SO) add_library(yaml::yaml SHARED IMPORTED) # --- WICHTIG: Schnittstellen-Include-Pfade definieren --- # Dadurch wird 'iniparser/iniparser.h' gefunden set_target_properties(yaml::yaml PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${YAML_INCLUDE_DIR}" IMPORTED_LOCATION "${YAML_LIBRARIES}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) # Wenn es eine statische Bibliothek ist, verwenden wir IMPORTED_LINK_INTERFACE_LIBRARIES # Das Ziel benötigt KEINE zusätzlichen Bibliotheken (wie pthread oder ws2_32), # da libyaml diese nicht exponiert. if (YAML_LIBRARIES MATCHES "\\.a$|\\.lib$") # --- WICHTIG: Speicherorte der Binärdateien definieren --- # Die tatsächlichen Namen können je nach System (Windows/Linux) und Compiler variieren. # Hier wird das Standard-Muster für Windows-Installationen angenommen: # Release Konfiguration (für dynamisches Linken unter Windows) set_target_properties(yaml::yaml PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "" IMPORTED_LOCATION_RELEASE "${YAML_LIBRARY_DIR}/yaml.dll" IMPORTED_IMPLIB_RELEASE "${YAML_LIBRARY_DIR}/yaml.lib" IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "" # Keine weiteren Abhängigkeiten für die Schnittstelle ) # Optional: Debug Konfiguration if (EXISTS "${YAML_LIBRARY_DIR}/yaml-d.dll") set_target_properties(yaml::yaml PROPERTIES IMPORTED_LOCATION_DEBUG "${YAML_LIBRARY_DIR}/yaml-d.dll" IMPORTED_IMPLIB_DEBUG "${YAML_LIBRARY_DIR}/yaml-d.lib" IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "" ) endif() # Optional: Setze die globale YAML_LIBRARIES Variable für Legacy-Code set(YAML_LIBRARIES "yaml::yaml" CACHE STRING "The YAML library target.") endif() No newline at end of file Loading
backends/CMakeLists.txt +5 −5 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ if(YAML_FOUND) if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") # Ensure 'confplus' is linked as PRIVATE unless its interface is exposed target_link_libraries(yamlconf PRIVATE confplus yaml::yaml kernel32.lib) target_link_libraries(yamlconf PRIVATE confplus yaml kernel32.lib) else() target_link_libraries(yamlconf PRIVATE confplus yaml::yaml dl) target_link_libraries(yamlconf PRIVATE confplus yaml dl) endif() install(TARGETS yamlconf Loading @@ -31,7 +31,7 @@ if(YAML_FOUND) endif() # --- INIPARSER BACKEND (Corrected) --- find_package(INIPARSER) find_package(INIPARSER REQUIRED) if(INIPARSER_FOUND) set( inisrc ini/ini.cpp) Loading @@ -44,9 +44,9 @@ if(INIPARSER_FOUND) # We remove target_include_directories and rely on INIPARSER::INIPARSER. if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_link_libraries(iniconf PRIVATE confplus iniparser::iniparser kernel32.lib) target_link_libraries(iniconf PRIVATE confplus iniparser kernel32.lib) else() target_link_libraries(iniconf PRIVATE confplus iniparser::iniparser dl) target_link_libraries(iniconf PRIVATE confplus iniparser dl) endif() install(TARGETS iniconf Loading
cmake/FindINIPARSER.cmake +38 −36 Original line number Diff line number Diff line # FindINIPARSER.cmake # 1. Search for the INIPARSER header file (iniparser.h) find_path(INIPARSER_INCLUDE_DIR NAMES iniparser.h PATHS /usr/local /usr HINTS ENV{INIPARSER_ROOT} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES include ) # 2. Search for the library file (libiniparser.a/lib, iniparser.lib) find_library(INIPARSER_LIBRARY NAMES iniparser libiniparser # Corrected to include libiniparser PATHS /usr/local /usr HINTS ENV{INIPARSER_ROOT} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES lib ) # iniparser-config.cmake # -------------------------------------------------------------------------- # 1. Definieren der Pfadvariablen (Simulieren der Installationslogik) # -------------------------------------------------------------------------- if(DEFINED CMAKE_PREFIX_PATH) list(GET CMAKE_PREFIX_PATH 0 INIPARSER_ROOT) # Nimm den ersten Pfad in der Liste elseif(DEFINED CMAKE_INSTALL_PREFIX) set(INIPARSER_ROOT "${CMAKE_INSTALL_PREFIX}") else() # Fallback zur Berechnung basierend auf dem Speicherort dieser Datei get_filename_component(INIPARSER_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE) endif() # 3. Handle standard arguments (set INIPARSER_FOUND) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(INIPARSER DEFAULT_MSG INIPARSER_LIBRARY INIPARSER_INCLUDE_DIR ) # Setze die Variablen, die von der installierten iniparser erwartet werden # Die Header liegen oft direkt in <prefix>/include set(INIPARSER_INCLUDE_DIR "${INIPARSER_ROOT}/include") set(INIPARSER_LIBRARY_DIR "${INIPARSER_ROOT}/lib") # In your FindINIPARSER.cmake: # -------------------------------------------------------------------------- # 2. Erstellen des Namespaced IMPORTED Targets # -------------------------------------------------------------------------- # 4. Create the modern IMPORTED target (if found) if(INIPARSER_FOUND AND NOT TARGET iniparser::iniparser) # Use lowercase target name # Create the target using the lowercase name add_library(iniparser::iniparser INTERFACE IMPORTED) # Definieren des Targets mit Namensraum (iniparser::iniparser) if (NOT TARGET iniparser::iniparser) # iniparser ist typischerweise eine C-Bibliothek, hier als STATIC importiert add_library(iniparser::iniparser STATIC IMPORTED) set_target_properties(iniparser::iniparser PROPERTIES # Use lowercase target name # --- WICHTIG: Schnittstellen-Include-Pfade definieren --- # Dadurch wird der Header-Pfad automatisch an abhängige Targets weitergegeben. set_target_properties(iniparser::iniparser PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${INIPARSER_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${INIPARSER_LIBRARY}" ) message(STATUS "SUCCESS: Defined modern target iniparser::iniparser.") endif() # --- END CORRECTED LOGIC --- # --- WICHTIG: Speicherorte der Binärdateien definieren --- # Release Konfiguration (Der tatsächliche Link-Name in vcpkg/Installation ist oft 'iniparser-static') set_target_properties(iniparser::iniparser PROPERTIES # Setze den tatsächlichen Speicherort der statischen Bibliothek IMPORTED_LOCATION_RELEASE "${INIPARSER_LIBRARY_DIR}/iniparser-static.lib" ) # 5. Mark variables as advanced mark_as_advanced(INIPARSER_LIBRARY INIPARSER_INCLUDE_DIR) No newline at end of file # Setze INIPARSER_FOUND set(INIPARSER_FOUND TRUE) endif() No newline at end of file
cmake/FindYAML.cmake +51 −42 Original line number Diff line number Diff line # CMake module to search for the C library libyaml # # If the library is found, then YAML_FOUND is set to TRUE, # and following variables are set: # YAML_INCLUDE_DIR # YAML_LIBRARIES # 1. Include directory search find_path(YAML_INCLUDE_DIR NAMES yaml.h) # 2. Configure library search for static libraries # Speichern Sie die aktuellen Such-Suffixe set(ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Stellen Sie sicher, dass wir nach den statischen Suffixen suchen if (WIN32) # Unter Windows suchen wir explizit nach .lib (statisch) vor .dll (dynamisch) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) # yaml-config.cmake # -------------------------------------------------------------------------- # 1. Definieren der Pfadvariablen (Simulieren der Installationslogik) # -------------------------------------------------------------------------- # Setze YAML_ROOT basierend auf dem Pfad dieser Datei, um die Installation zu finden # CMAKE_CURRENT_LIST_DIR ist der Ordner, in dem diese Datei liegt. # Gehe zwei Ebenen hoch, um zum Installations-Präfix zu gelangen (z.B. /install/lib/cmake/yaml/ -> /install) if(DEFINED CMAKE_PREFIX_PATH) list(GET CMAKE_PREFIX_PATH 0 YAML_ROOT) # Nimm den ersten Pfad in der Liste elseif(DEFINED CMAKE_INSTALL_PREFIX) set(YAML_ROOT "${CMAKE_INSTALL_PREFIX}") else() # Unter Unix/Linux/macOS ist .a das statische Standard-Suffix set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Fallback zur Berechnung basierend auf dem Speicherort dieser Datei get_filename_component(YAML_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE) endif() # 3. Search for the static library find_library(YAML_LIBRARIES NAMES yaml libyaml) # 4. Set Suffixes back to original set(CMAKE_FIND_LIBRARY_SUFFIXES ${ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES}) # Setze die Variablen, die von der installierten libyaml erwartet werden # Dies sind nur Beispiele; Sie müssen die tatsächlichen Pfade in Ihrer Umgebung prüfen! set(YAML_INCLUDE_DIR "${YAML_ROOT}/include") set(YAML_LIBRARY_DIR "${YAML_ROOT}/lib") # Stellen Sie sicher, dass die Variablen gesetzt sind, bevor Sie sie verwenden set(YAML_FOUND TRUE) # 5. Handle standard arguments include(FindPackageHandleStandardArgs) find_package_handle_standard_args(YAML DEFAULT_MSG YAML_LIBRARIES YAML_INCLUDE_DIR) mark_as_advanced(YAML_INCLUDE_DIR YAML_LIBRARIES) # -------------------------------------------------------------------------- # 2. Erstellen des Namespaced IMPORTED Targets # -------------------------------------------------------------------------- # 6. Create IMPORTED Target for modern CMake usage # WICHTIG: Verwenden Sie 'yaml::yaml', um den Anforderungen von libconfplus zu entsprechen. if (YAML_FOUND AND NOT TARGET yaml::yaml) # Target mit dem korrekten Namen erstellen add_library(yaml::yaml UNKNOWN IMPORTED) # Definieren des Namensraum-Targets, wie in der CMakeLists.txt gewünscht if (NOT TARGET yaml::yaml) # Da es sich um eine C-Bibliothek handelt, definieren wir sie als Shared (DLL/SO) add_library(yaml::yaml SHARED IMPORTED) # --- WICHTIG: Schnittstellen-Include-Pfade definieren --- # Dadurch wird 'iniparser/iniparser.h' gefunden set_target_properties(yaml::yaml PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${YAML_INCLUDE_DIR}" IMPORTED_LOCATION "${YAML_LIBRARIES}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) # Wenn es eine statische Bibliothek ist, verwenden wir IMPORTED_LINK_INTERFACE_LIBRARIES # Das Ziel benötigt KEINE zusätzlichen Bibliotheken (wie pthread oder ws2_32), # da libyaml diese nicht exponiert. if (YAML_LIBRARIES MATCHES "\\.a$|\\.lib$") # --- WICHTIG: Speicherorte der Binärdateien definieren --- # Die tatsächlichen Namen können je nach System (Windows/Linux) und Compiler variieren. # Hier wird das Standard-Muster für Windows-Installationen angenommen: # Release Konfiguration (für dynamisches Linken unter Windows) set_target_properties(yaml::yaml PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "" IMPORTED_LOCATION_RELEASE "${YAML_LIBRARY_DIR}/yaml.dll" IMPORTED_IMPLIB_RELEASE "${YAML_LIBRARY_DIR}/yaml.lib" IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "" # Keine weiteren Abhängigkeiten für die Schnittstelle ) # Optional: Debug Konfiguration if (EXISTS "${YAML_LIBRARY_DIR}/yaml-d.dll") set_target_properties(yaml::yaml PROPERTIES IMPORTED_LOCATION_DEBUG "${YAML_LIBRARY_DIR}/yaml-d.dll" IMPORTED_IMPLIB_DEBUG "${YAML_LIBRARY_DIR}/yaml-d.lib" IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "" ) endif() # Optional: Setze die globale YAML_LIBRARIES Variable für Legacy-Code set(YAML_LIBRARIES "yaml::yaml" CACHE STRING "The YAML library target.") endif() No newline at end of file