Also install a pkg-config file

This for interoperability with other build systems
pull/1418/head
ytnuf 2024-11-18 16:05:49 +00:00
parent cd6bb165fa
commit 1f6f05e7ae
2 changed files with 23 additions and 0 deletions

10
cmake/godot-cpp.pc.in Normal file
View File

@ -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}

View File

@ -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()