Skip to content

Commit 5f14e45

Browse files
committed
Also install a pkg-config file
This for interoperability with other build systems
1 parent 0434a63 commit 5f14e45

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

cmake/godot-cpp.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=${prefix}
3+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
4+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
5+
6+
Name: godot-cpp
7+
Description: C++ bindings for the Godot script API
8+
Version: @GODOT_API_VERSION@
9+
Libs: -L${libdir} -l@GODOTCPP_OUTPUT_NAME@
10+
Cflags: -I${includedir}

cmake/godotcpp.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,5 +287,18 @@ function( godotcpp_installable )
287287
DESTINATION "${GODOT_INSTALL_CMAKEDIR}"
288288
COMPONENT "godot-cpp"
289289
)
290+
291+
# Install the pkg-config file
292+
get_target_property(GODOTCPP_OUTPUT_NAME "${PROJECT_NAME}" OUTPUT_NAME)
293+
configure_file(
294+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/godot-cpp.pc.in"
295+
"${CMAKE_CURRENT_BINARY_DIR}/godot-cpp.pc"
296+
@ONLY
297+
)
298+
install(
299+
FILES "${CMAKE_CURRENT_BINARY_DIR}/godot-cpp.pc"
300+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
301+
COMPONENT "godot-cpp"
302+
)
290303
endif()
291304
endfunction()

0 commit comments

Comments
 (0)