Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] CMake: install raylib-config.cmake #471

Closed
a3f opened this issue Feb 16, 2018 · 6 comments · Fixed by #608
Closed

[build] CMake: install raylib-config.cmake #471

a3f opened this issue Feb 16, 2018 · 6 comments · Fixed by #608
Labels
good first issue Good first issue to help with help needed - please! I need help with this issue

Comments

@a3f
Copy link
Contributor

a3f commented Feb 16, 2018

We already install a raylib.pc file for pkg-config, but we probably should also install a raylib-config.cmake, so dependent CMake projects can use it.

Documentation: https://cmake.org/cmake/help/git-master/manual/cmake-packages.7.html#creating-packages

@raysan5 raysan5 changed the title [BUILD] CMake: install RaylibConfig.cmake [build] CMake: install RaylibConfig.cmake Feb 19, 2018
@raysan5
Copy link
Owner

raysan5 commented Feb 19, 2018

Could it be raylibConfig.cmake for library naming consistency? Or the requirement for that kind of file is starting with capital letter?

@a3f
Copy link
Contributor Author

a3f commented Feb 19, 2018

It's a convention, but CMake also accepts raylib-config.cmake.

@a3f a3f changed the title [build] CMake: install RaylibConfig.cmake [build] CMake: install raylib-config.cmake Feb 19, 2018
@raysan5
Copy link
Owner

raysan5 commented Feb 19, 2018

ok, I prefer this option, I always name files in lower-case convention...

@a3f a3f added help needed - please! I need help with this issue good first issue Good first issue to help with labels Mar 16, 2018
@a3f
Copy link
Contributor Author

a3f commented May 21, 2018

The CMakeLists.txt in examples/ and games/ have the build/ directory hardcoded, which kinda defeats the purpose of doing out-of-tree builds. That should probably be fixed too...
The link_libraries_to_executable function in cmake/utils.cmake is a hack that should be got rid off as well.

@raysan5
Copy link
Owner

raysan5 commented Jul 13, 2018

@a3f what's the state of this issue? could it be closed?

@a3f
Copy link
Contributor Author

a3f commented Jul 13, 2018 via email

a3f added a commit to a3f/raylib that referenced this issue Jul 29, 2018
Remove that link_libraries_to_executable() hack and defines a proper
raylib 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:

- Remove hardcoded build directories from examples and games CMakeLists.txt
- Allow rlgl_standalone and other special examples to be built easily
- Allow CMake projects to find_package(raylib instead of fiddling with pkg-config
- Makes code a little more maintainable
- Fixes raysan5#471, raysan5#606.
- Makes code less confusing by removing the double use of PLATFORM (raysan5#584).

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 by find_package.
a3f added a commit to a3f/raylib that referenced this issue Jul 29, 2018
Remove that link_libraries_to_executable() hack and defines a proper
raylib 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:

- Remove hardcoded build directories from examples and games CMakeLists.txt
- Allow rlgl_standalone and other special examples to be built easily
- Allow CMake projects to find_package(raylib instead of fiddling with pkg-config
- Makes code a little more maintainable
- Fixes raysan5#471, raysan5#606.
- Makes code less confusing by removing the double use of PLATFORM (raysan5#584).

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 by find_package.
a3f added a commit to a3f/raylib that referenced this issue Jul 29, 2018
Remove that link_libraries_to_executable() hack and defines a proper
raylib 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:

- Remove hardcoded build directories from examples and games CMakeLists.txt
- Allow rlgl_standalone and other special examples to be built easily
- Allow CMake projects to find_package(raylib instead of fiddling with pkg-config
- Makes code a little more maintainable
- Fixes raysan5#471, raysan5#606.
- Makes code less confusing by removing the double use of PLATFORM (raysan5#584).

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 by find_package.
a3f added a commit to a3f/raylib that referenced this issue Jul 29, 2018
Remove that link_libraries_to_executable() hack and defines a proper
raylib 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:

- Remove hardcoded build directories from examples and games CMakeLists.txt
- Allow rlgl_standalone and other special examples to be built easily
- Allow CMake projects to find_package(raylib instead of fiddling with pkg-config
- Makes code a little more maintainable
- Fixes raysan5#471, raysan5#606.
- Makes code less confusing by removing the double use of PLATFORM (raysan5#584).

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 by find_package.
@a3f a3f closed this as completed in #608 Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good first issue to help with help needed - please! I need help with this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants