Skip to content

Fix CMake config mode package finding - #129

Open
jnhyatt wants to merge 1 commit into
gulrak:masterfrom
jnhyatt:cmake-fix
Open

Fix CMake config mode package finding#129
jnhyatt wants to merge 1 commit into
gulrak:masterfrom
jnhyatt:cmake-fix

Conversation

@jnhyatt

@jnhyatt jnhyatt commented Jun 15, 2021

Copy link
Copy Markdown
Contributor

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

gulrak commented Jul 4, 2021

Copy link
Copy Markdown
Owner

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

musicinmybrain commented Sep 17, 2023

Copy link
Copy Markdown
Contributor

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