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 installation issues #91

Merged
merged 1 commit into from
Mar 11, 2025
Merged

Fix CMake installation issues #91

merged 1 commit into from
Mar 11, 2025

Conversation

marovira
Copy link
Contributor

What is Being Fixed

This pull request fixes two issues I noticed when I installed the library for development:

  1. The package version manifest isn't being installed.
  2. There is no way to install debug and release builds of the library without manually forcing CMake to do so.

Issue 1

A common practice when using find_package in CMake is to pin the minimum required version so there are no conflicts between the user code and libraries. This is generally achieved by doing find_package(<name> <version>). This relies on the existence of a <name>configVersion.cmake file being installed into lib/cmake/<name>. With the current code, this file is never generated and so never installed, preventing users from requesting a specific version of fastgltf.

Issue 2

When building in Windows with Visual Studio, it is common practice to build and install two sets of binaries: one for debug and one for release builds. In user code, CMake will then automatically link the correct binary for the appropriate build. In the current CMake code, there is no way to differentiate between the debug and release builds. This results in the following: if debug is built and installed first, followed by release, the debug library will be overwritten as both debug and release are called fastgltf.lib. Using this library in debug builds triggers compiler errors due to mismatched optimisation levels.

This can be worked around by manually setting CMAKE_DEBUG_POSTFIX=d when building the library, which is error prone and is better set by the library itself.

I have verified that both issues are solved with this pull request, and based on past experience with other libraries, doesn't negatively impact other platforms. I think this won't be an issue with vcpkg but I've never used it before.

@spnda spnda merged commit 8d0e095 into spnda:main Mar 11, 2025
18 checks passed
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.

2 participants