CMake: Major cleanup to support find_package(raylib) #608
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove that
link_libraries_to_executable()
hack and defines a properraylib target that can be used with
target_link_libraries
.The same target is also available for external (user) code by using
find_package(raylib)
.This results in:
CMakeLists.txt
rlgl_standalone
and other special examples to be built easilyfind_package(raylib)
instead of fiddling withpkg-config
PLATFORM
(raylib 2.0 build problem #584).CMakeLists.txt
to look like this:Note that this is still not The Right Way(TM), because normally
raylib-config.cmake
(or its includes) would be automatically generated.I didn't manage to get that to work though, so I went the easier route
of just wrapping
pkg_check_modules
for consumption byfind_package
.Also included in the branch is a new
-DINCLUDE_EVERYTHING
flag to test even off-by-default options in CI and a fix for a CMake+OpenAL regression.