build CHANGE split project version and library version
To improve versioning process, we want to have version of the project
separated from the library version. While the library version is
supposed to be tightly connected with API/ABI changes, project versions
will move more slowly to show changes in the project concepts.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3f1893..88da234 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,12 +15,17 @@
# Correct RPATH usage on OS X
set(CMAKE_MACOSX_RPATH TRUE)
-# set version
-set(LIBYANG_MAJOR_VERSION 1)
+# set version of the project
+set(LIBYANG_MAJOR_VERSION 2)
set(LIBYANG_MINOR_VERSION 0)
set(LIBYANG_MICRO_VERSION 0)
set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION})
-set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION})
+# set version of the library
+set(LIBYANG_MAJOR_SOVERSION 2)
+set(LIBYANG_MINOR_SOVERSION 0)
+set(LIBYANG_MICRO_SOVERSION 0)
+set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION})
+set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION})
# set default build type if not specified by user
if(NOT CMAKE_BUILD_TYPE)
@@ -223,7 +228,7 @@
target_link_libraries(yang ${CMAKE_DL_LIBS})
endif(ENABLE_STATIC)
-set_target_properties(yang PROPERTIES VERSION ${LIBYANG_VERSION} SOVERSION ${LIBYANG_SOVERSION})
+set_target_properties(yang PROPERTIES VERSION ${LIBYANG_SOVERSION_FULL} SOVERSION ${LIBYANG_SOVERSION})
set_target_properties(yangobj PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
# link math
diff --git a/src/config.h.in b/src/config.h.in
index 0d9284b..be52bdb 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -27,8 +27,9 @@
*/
#define _PACKED @COMPILER_PACKED_ATTR@
-#define LY_VERSION_MAJOR @LIBYANG_MAJOR_VERSION@ /**< libyang major version number */
-#define LY_VERSION_MINOR @LIBYANG_MINOR_VERSION@ /**< libyang minor version number */
-#define LY_VERSION_MICRO @LIBYANG_MICRO_VERSION@ /**< libyang micro version number */
+#define LY_VERSION_MAJOR @LIBYANG_MAJOR_SOVERSION@ /**< libyang major version number */
+#define LY_VERSION_MINOR @LIBYANG_MINOR_SOVERSION@ /**< libyang minor version number */
+#define LY_VERSION_MICRO @LIBYANG_MICRO_SOVERSION@ /**< libyang micro version number */
+#define LY_VERSION "@LIBYANG_SOVERSION_FULL@" /**< libyang version string */
#endif /* LY_CONFIG_H_ */