@@ -23,3 +23,15 @@ install (TARGETS ubootenv DESTINATION lib)
install (FILES libuboot.h DESTINATION include)
install (TARGETS fw_printenv DESTINATION bin)
install (TARGETS fw_setenv DESTINATION bin)
+
+# Handle pkg-config files
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
+set(includedir ${CMAKE_INSTALL_PREFIX}/include)
+set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
+
+configure_file(${CMAKE_SOURCE_DIR}/src/libubootenv.pc.in ${CMAKE_BINARY_DIR}/libubootenv.pc @ONLY)
+set(LIBUBOOTENV_PKG_CONFIG_FILES ${CMAKE_BINARY_DIR}/libubootenv.pc)
+message(STATUS "Generate ${LIBUBOOTENV_PKG_CONFIG_FILES}")
+# Install pkg-config files
+install(FILES ${LIBUBOOTENV_PKG_CONFIG_FILES} DESTINATION lib/pkgconfig)
new file mode 100644
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libubootenv
+Description: Library to access U-Boot environment
+Version: @VERSION@
+Libs: -L${libdir} -lubootenv -lz
+Cflags: -I${includedir}
Create a libubootenv.pc file for pkg-config. Allows to use PKG_CHECK_MODULE in autoconf-based projects or : ubootenv_dep = dependency('libubootenv', version : '>= 0.2') for meson build system. Fixes: $: meson build The Meson build system Cross C compiler: arm-poky-linux-gnueabi-gcc ... [...] Cross dependency libubootenv found: NO (tried pkgconfig) With this commit: $: meson builld The Meson build system Cross C compiler: arm-poky-linux-gnueabi-gcc ... [...] Cross dependency libubootenv found: YES 0.2 Build targets in project: 1 Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io> --- Changes v1 -> v2 - Remove PROJECT_NAME variable (after review of Stefano) src/CMakeLists.txt | 12 ++++++++++++ src/libubootenv.pc.in | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/libubootenv.pc.in