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
Fix installation path of CMake package files #460
Conversation
| @@ -567,7 +567,7 @@ if (GLFW_INSTALL) | |||
|
|
|||
| install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" | |||
| "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" | |||
| DESTINATION lib${LIB_SUFFIX}/cmake/glfw) | |||
| DESTINATION ${GLFW_CONFIG_PATH}) | |||
|
|
|||
| install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be appropriate to change glfwTargets DESTINATION to ${GLFW_CONFIG_PATH} as well.
|
Fixed the glfwTargets |
|
I would set them to ${GLFW3_INCLUDE_DIR} and ${GLFW3_LIBRARY_DIR}, respectively, to maintain SSOT. But before implementing this change, remind me of the rational of defining two sets of _LIBRARY, _INCLUDE_DIR and _LIBRARY_DIR with GLFW and GLFW3 prefixes? Is this to maintain some backwards compatibility? |
|
No, i just wanted to keep it uniform with package name. What is the reason config prefix is glfw3 not simply glfw? |
|
I believe this was done intentionally, as not to cause confusion with installations of the now-legacy glfw2.x. |
|
A quick build of your master branch yields the following: I think the correct fix is to change GLFW_CONFIG_PATH to a relative path, namely To address the original intent of your pull request, linking external projects with ease, |
|
I spent some significant time reviewing cmake, cmake targets, etc. and I have a solution. I will try an submit a pull request to your master branch by 5EST! Afterwards we should do some prelim builds and tests, just to be sure everything is working. |
|
Merged @ngvitovitch changes into pull request - they add link libraries as transitive dependency, I've added include directory as well. This change removes need to set include_directories and target_link_libraries (for transitive dependencies). Example: |
|
Tested on Mac OS X. |
|
Will test on Windows, Linux at my earliest convenience. Could you confirm that the generated glfw3Targets* files contain no absolute paths? I am mildly suspicious of the latest target_include_dirs(). |
|
It does contain absolute path because relative path nor source/binary On Wed, 11 Mar 2015 at 22:22 Nicholas Gregory Vitovitch <
|
|
Not true, the absolute path is not necessary and moreover it breaks portability of the package. Example:
Check out this example using CMake generator expressions: http://www.cmake.org/cmake/help/v3.0/command/target_include_directories.html Also, target_include_directories was introduced in CMake 2.8.11 and will cause an error when building with glfw's minimum required version of CMake (2.8.9). If this command is included, it needs to be if-guarded for older versions of CMake. |
|
@elmindreda @ngvitovitch: BTW. Since C++11 is already enforced, and Ubuntu 14.04 LTS comes with CMake 2.8.12, maybe it would worth to bump cmake version to provide uniform build. |
|
@elmindreda requesting feedback on PR |
|
Will do after 3.1.1. Only one issue remaining. |
|
@elmindreda huzzah for the 3.1.1 release! |
|
Please make your commit messages well formed. Subject line max 50 characters, remaining lines max 72 characters, empty lines between paragraphs. |
|
@elmindreda Reformatted commit messages |
|
@elmindreda PR ready for merge |
|
@shaxbee I know. I'm just catching up. |
|
Rebased, added Travis CI to track CMake <3.0 compatibility |
|
@elmindreda Any ETA on merging this? |
9fdee6e
to
66d3aab
Compare
|
I've picked out bits I wanted from this patch set. There's a lot of good stuff here, but also some bugs, things I won't be merging and things I'd already fixed while learning modern CMake so I could tackle this issue. I've tried to retain proper credits for all the pieces, but not at the expense of clear patches without backtracking. Thank you so much, both of you, and sorry for taking so long to get to this. |
|
Also merged bits of the Travis and Appveyor CI files. Thanks! |
Installation path prevented cmake from finding GLFW. It seems that INSTALL_DIRECTORY was correct but path provided to INSTALL command was not updated.
Added GLFW_LIBRARIES export to glfwConfig.cmake.in as well.
Now it is possible to use glfw with externalproject_add and find_package as follows: