summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMillian Poquet <millian.poquet@gmail.com>2021-02-22 19:23:38 +0100
committerGitHub <noreply@github.com>2021-02-22 10:23:38 -0800
commit1da6f4f18bdc7f47cd84f58a427835f2b790cb29 (patch)
treecd36f5c9bf8d2e294f8483a4e5cdeb06a39ab7d2 /CMakeLists.txt
parentb5da526e6d44dfab9b03398af229eebbe835cc1e (diff)
downloadflatbuffers-1da6f4f18bdc7f47cd84f58a427835f2b790cb29.tar.gz
flatbuffers-1da6f4f18bdc7f47cd84f58a427835f2b790cb29.tar.bz2
flatbuffers-1da6f4f18bdc7f47cd84f58a427835f2b790cb29.zip
[CMake] generate pkg-config flatbuffers.pc file (#6455)
This commit enables CMake to generate a flatbuffers.pc file on install. pkg-config eases the utilization of software libraries by enabling the developers of a library to define how the library should be used. It can be used as a tool by build systems to find and manage dependencies, this is notably the default Meson behavior and optionally used by CMake.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7c0b0a7..f56f844f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -629,6 +629,14 @@ if(FLATBUFFERS_INSTALL)
DESTINATION ${FB_CMAKE_DIR}
)
endif()
+
+ if(FLATBUFFERS_BUILD_SHAREDLIB OR FLATBUFFERS_BUILD_FLATLIB)
+ configure_file(CMake/flatbuffers.pc.in flatbuffers.pc @ONLY)
+ install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/flatbuffers.pc"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+ )
+ endif()
endif()
if(FLATBUFFERS_BUILD_TESTS)