[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:
parent
79188f570b
commit
c53dd8a931
7 changed files with 43 additions and 110 deletions
23
cmake/SetupCmakeConfig.cmake
Normal file
23
cmake/SetupCmakeConfig.cmake
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Setup install of exported targets
|
||||
install(EXPORT raylib-targets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/raylib
|
||||
)
|
||||
|
||||
# Macro to write config
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake"
|
||||
VERSION ${raylib_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Setup install of version config
|
||||
install(
|
||||
FILES
|
||||
"../cmake/raylib-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake"
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_LIBDIR}/cmake/raylib
|
||||
)
|
||||
Loading…
Reference in a new issue