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

Fix CMake config mode package finding #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jnhyatt
Copy link
Contributor

@jnhyatt jnhyatt commented Jun 15, 2021

During a recent build, I realized that find_package was unable to find ghcfilesystem with it installed in my CMake prefix path (on Windows). After some poking around, I nailed it down to the final install directory not matching any of the search patterns in CMake's config mode package finder search procedure. The directory ghc_filesystem-config.cmake should be in must look like one of these in order to be found without special tweaks to the package find procedure:

<prefix-path>/ghc_filesystem-config.cmake
<prefix-path>/cmake/ghc_filesystem-config.cmake
<prefix-path>/ghc_filesystem*/ghc_filesystem-config.cmake
<prefix-path>/ghc_filesystem*/cmake/ghc_filesystem-config.cmake
<prefix-path>/lib/cmake/ghc_filesystem*/ghc_filesystem-config.cmake
<prefix-path>/lib/ghc_filesystem*/ghc_filesystem-config.cmake
<prefix-path>/lib/ghc_filesystem*/cmake/ghc_filesystem-config.cmake
<prefix-path>/ghc_filesystem*/lib/cmake/ghc_filesystem*/ghc_filesystem-config.cmake
<prefix-path>/ghc_filesystem*/lib/ghc_filesystem/ghc_filesystem-config.cmake
<prefix-path>/ghc_filesystem*/lib/ghc_filesystem/cmake/ghc_filesystem-config.cmake

Because the project name was ghcfilesystem, the default path was <prefix-path>/ghcfilesystem/lib/cmake/ghc_filesystem/ghc_filesystem-config.cmake (missing underscore). This problem likely doesn't manifest on Linux due to the way a make install works. Once I fixed the project name, CMake find_package was able to find the package with no problems.

@gulrak
Copy link
Owner

gulrak commented Jul 4, 2021

Sorry, I didn't react for so long. Was pretty occupied lately. I'll look into it and do some tests. As this will change the project file names for IDEs like Xcode or Visual Studio, I would put this into a new minor version, so the upcoming version will be a v1.6.0 I guess.

@gulrak gulrak added this to the v1.6.0 milestone Apr 3, 2022
@musicinmybrain
Copy link
Contributor

musicinmybrain commented Sep 17, 2023

We just ran into this in Fedora Linux. Is this still planned for a 1.6.0 release somewhere in the indefinite future? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants