-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
To increase the compatibility to different systems it would be gread that this package support yaml-cpp 0.5 and yaml-cpp 0.3.
To make this possible follow this steps:
Rework this lines:
https://github.com/rock-simulation/configmaps/blob/master/CMakeLists.txt#L9-L14
to somethig like (untested):
pkg_check_modules(YAML REQUIRED
yaml-cpp
)
include_directories(${YAML_INCLUDE_DIRS})
link_directories(${YAML_LIBRARY_DIRS})
add_definitions(${YAML_CFLAGS_OTHER}) #flags excluding the ones with -I
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_MAJOR_VERSION ${YAML_VERSION}")
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_MINOR_VERSION ${YAML_VERSION}")
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_PATCH_VERSION ${YAML_VERSION}")
add_definitions("-DYAML_MINOR_VERSION=${YAML_MINOR_VERSION})
add_definitions("-DYAML_MAJOR_VERSION=${YAML_MAJOR_VERSION})
add_definitions("-DYAML_PATCH_VERSION=${YAML_PATCH_VERSION})
add_definitions(${PKGCONFIG_CFLAGS_OTHER}) #flags excluding the ones with -I
In the c++ code you can then identify the version by:
#if YAML_MAJOR_VERSION == 0
#if YAML_MINOR_VERSION == 3
//Put here the old-code
#endif
#endif
//Put here the new-code and hope they keep the API backward compatible
Metadata
Metadata
Assignees
Labels
No labels