From 1f6f05e7ae1ef38fd7f4a673da858dfe9598f13a Mon Sep 17 00:00:00 2001 From: ytnuf <161308826+ytnuf@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:05:49 +0000 Subject: [PATCH] Also install a pkg-config file This for interoperability with other build systems --- cmake/godot-cpp.pc.in | 10 ++++++++++ cmake/godotcpp.cmake | 13 +++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 cmake/godot-cpp.pc.in diff --git a/cmake/godot-cpp.pc.in b/cmake/godot-cpp.pc.in new file mode 100644 index 00000000..1813706b --- /dev/null +++ b/cmake/godot-cpp.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ + +Name: godot-cpp +Description: C++ bindings for the Godot script API +Version: @GODOT_API_VERSION@ +Libs: -L${libdir} -l@GODOTCPP_OUTPUT_NAME@ +Cflags: -I${includedir} diff --git a/cmake/godotcpp.cmake b/cmake/godotcpp.cmake index 6ece913a..a622c68d 100644 --- a/cmake/godotcpp.cmake +++ b/cmake/godotcpp.cmake @@ -287,5 +287,18 @@ function( godotcpp_installable ) DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/godot" COMPONENT "godot-cpp" ) + + # Install the pkg-config file + get_target_property(GODOTCPP_OUTPUT_NAME "${PROJECT_NAME}" OUTPUT_NAME) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/godot-cpp.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/godot-cpp.pc" + @ONLY + ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/godot-cpp.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + COMPONENT "godot-cpp" + ) endif() endfunction()