[build][cmake] Improve cmake config file generation (#4541)

* Improve cmake config file generation

This allows for finding raylib on a non-standard location (eg, not in /usr/lib{,64})

* Only have glfw as private if using internal glfw and not static
This commit is contained in:
Leonardo Guilherme de Freitas 2024-11-27 07:39:36 -03:00 committed by GitHub
parent 79188f570b
commit c53dd8a931
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 43 additions and 110 deletions

View file

@ -18,10 +18,8 @@ endif ()
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(../raylib.pc.in raylib.pc @ONLY)
configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
include(SetupCmakeConfig)
# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
include(PopulateConfigVariablesLocally)