build CHANGE install internal yang modules
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7d4c74..fa39f82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -238,6 +238,7 @@
option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF)
option(ENABLE_INTERNAL_DOCS "Generate doxygen documentation also from internal headers" OFF)
+set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/libyang" CACHE STRING "Directory where to copy the YANG modules to")
if(ENABLE_INTERNAL_DOCS)
set(doxy_files ${doxy_files} ${internal_headers})
@@ -405,6 +406,9 @@
list(APPEND g_headers ${PROJECT_BINARY_DIR}/${h})
endforeach()
+# install the modules
+install(DIRECTORY "${PROJECT_SOURCE_DIR}/models/" DESTINATION ${YANG_MODULE_DIR} FILES_MATCHING PATTERN "*.yang")
+
# install all library files
install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${headers} ${g_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang)
diff --git a/distro/pkg/deb/libyang2.install b/distro/pkg/deb/libyang2.install
index 3de3b10..e5f2c1c 100644
--- a/distro/pkg/deb/libyang2.install
+++ b/distro/pkg/deb/libyang2.install
@@ -1 +1,2 @@
usr/lib/*/*.so.*
+usr/share/yang
diff --git a/distro/pkg/rpm/libyang.spec b/distro/pkg/rpm/libyang.spec
index c6d7251..895567e 100644
--- a/distro/pkg/rpm/libyang.spec
+++ b/distro/pkg/rpm/libyang.spec
@@ -69,6 +69,7 @@
%license LICENSE
%{_libdir}/libyang.so.2
%{_libdir}/libyang.so.2.*
+%dir %{_datadir}/yang/
%files tools
%{_bindir}/yanglint