build system: add pkg-config support (#674)

This commit is contained in:
Alexandru-Sergiu Marton
2021-03-18 10:07:05 +02:00
committed by Michele Caini
parent f9c995f03f
commit 1ebf614d79
2 changed files with 22 additions and 0 deletions

View File

@@ -96,6 +96,12 @@ endif()
target_compile_features(EnTT INTERFACE cxx_std_17)
#
# Set pkg-config variables
#
set(EnTT_PKGCONFIG ${PROJECT_BINARY_DIR}/entt.pc)
set(EnTT_PKGCONFIG_DESTDIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
#
# Install EnTT
#
@@ -114,6 +120,12 @@ write_basic_package_version_file(
COMPATIBILITY AnyNewerVersion
)
configure_file(
"${EnTT_SOURCE_DIR}/cmake/in/entt.pc.in"
"${EnTT_PKGCONFIG}"
@ONLY
)
configure_package_config_file(
${EnTT_SOURCE_DIR}/cmake/in/EnTTConfig.cmake.in
EnTTConfig.cmake
@@ -142,6 +154,8 @@ install(
install(DIRECTORY src/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES "${EnTT_PKGCONFIG}" DESTINATION "${EnTT_PKGCONFIG_DESTDIR}")
export(PACKAGE EnTT)
#

8
cmake/in/entt.pc.in Normal file
View File

@@ -0,0 +1,8 @@
prefix=@CMAKE_INSTALL_PREFIX@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: EnTT
Description: Fast and reliable entity component system (ECS)
Url: https://github.com/skypjack/entt
Version: @EnTT_VERSION@
Cflags: -I${includedir}