fix(cmake): FindLibNoise: correct include dir, support Debian/Ubuntu header layout - #1130
Open
Danux-Be wants to merge 2 commits into
Open
fix(cmake): FindLibNoise: correct include dir, support Debian/Ubuntu header layout#1130Danux-Be wants to merge 2 commits into
Danux-Be wants to merge 2 commits into
Conversation
The module searched for 'noise.h' with PATH_SUFFIXES 'include/noise', which resolves to <prefix>/include/noise. Since the sources include libnoise as <noise/noise.h>, the include dir must be <prefix>/include. Searching for 'noise/noise.h' with suffix 'include' makes system installs work without a manual -DLibNoise_INCLUDE_DIR override.
Distro packages install the headers in <prefix>/include/libnoise/ while the sources include <noise/noise.h> (upstream/Conan layout uses <prefix>/include/noise/). When only the libnoise/ layout is found, the find module now creates a noise-compat directory in the build tree with a 'noise' symlink pointing at the distro folder. Verified against both layouts: the game and the test suite build with distro packages (Ubuntu libnoise-dev 1.0.0) and with a source install.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related fixes to
FindLibNoise.cmake, discovered while building the project with distro packages (no Conan):1. Include dir resolved to the wrong directory
The module searched for
noise.hwithPATH_SUFFIXES include include/noise …, soLibNoise_INCLUDE_DIRresolved to<prefix>/include/noise. Since the sources include libnoise as<noise/noise.h>, the include dir must be the parent (<prefix>/include). System installs failed at build time (fatal error: noise/noise.h: No such file or directory) unless one passed a manual-DLibNoise_INCLUDE_DIRoverride.The module now searches for
noise/noise.hwith suffixinclude.2. Debian/Ubuntu install the headers under
libnoise/, notnoise/libnoise-dev(Ubuntu 24.04: 1.0.0+repack-1build1) puts the headers in<prefix>/include/libnoise/. When only that layout is found, the module now creates anoise-compatdirectory in the build tree with anoise -> <prefix>/include/libnoisesymlink, so<noise/noise.h>keeps resolving — zero changes needed in the sources.Testing
Both layouts verified end-to-end (configure → full build → test suite):
<prefix>/include/noise/): builds, 53/53 tests passlibnoise-dev): green CI includingctest— see run Danux-Be/Cytopia #33274938804 (Build + Test + artifact upload, ~2m30)