build BUGFIX incorrectly removed libyang CPP bindings cmake search
# LIBYANG_LIBRARIES - Link these to use LibYANG
# LIBYANG_VERSION - SO version of the found libyang library
#
+# LIBYANG_CPP_FOUND - system has LibYANG C++ bindings
+# LIBYANG_CPP_INCLUDE_DIRS - the LibYANG C++ include directory
+# LIBYANG_CPP_LIBRARIES - Link these to use LibYANG C++ bindings
+#
# Author Radek Krejci <rkrejci@cesnet.cz>
# Copyright (c) 2015 CESNET, z.s.p.o.
#
@@ -82,3 +86,48 @@ else()
REQUIRED_VARS LIBYANG_LIBRARY LIBYANG_INCLUDE_DIR
VERSION_VAR LIBYANG_VERSION)
endif()
+
+#C++ bindings
+if (LIBYANG_CPP_LIBRARIES AND LIBYANG_CPP_INCLUDE_DIRS)
+ # in cache already
+ set(LIBYANG_CPP_FOUND TRUE)
+else ()
+ find_path(LIBYANG_CPP_INCLUDE_DIR
+ NAMES
+ libyang/Libyang.hpp
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ ${CMAKE_INCLUDE_PATH}
+ ${CMAKE_INSTALL_PREFIX}/include
+ )
+
+ find_library(LIBYANG_CPP_LIBRARY
+ NAMES
+ yang-cpp
+ libyang-cpp
+ PATHS
+ /usr/lib
+ /usr/lib64
+ /usr/local/lib
+ /usr/local/lib64
+ /opt/local/lib
+ /sw/lib
+ ${CMAKE_LIBRARY_PATH}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ )
+
+ if (LIBYANG_CPP_INCLUDE_DIR AND LIBYANG_CPP_LIBRARY)
+ set(LIBYANG_CPP_FOUND TRUE)
+ else ()
+ set(LIBYANG_CPP_FOUND FALSE)
+ endif ()
+
+ set(LIBYANG_CPP_INCLUDE_DIRS ${LIBYANG_CPP_INCLUDE_DIR})
+ set(LIBYANG_CPP_LIBRARIES ${LIBYANG_CPP_LIBRARY})
+
+ # show the LIBYANG_CPP_INCLUDE_DIRS and LIBYANG_CPP_LIBRARIES variables only in the advanced view
+ mark_as_advanced(LIBYANG_CPP_INCLUDE_DIRS LIBYANG_CPP_LIBRARIES)
+endif()
