conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.17k stars 974 forks source link

[question] How to prevent cmake from checking /usr/lib/x86_64-linux-gnu/cmake ? #12488

Open paulharris opened 1 year ago

paulharris commented 1 year ago

I can't build the OpenAL package on my system because it finds /usr/lib/x86_64-linux-gnu/cmake/PulseAudio/PulseAudioConfigVersion.cmake and then things fall apart due to cmake variables etc.

It shouldn't find that cmake file in the first place ... it was not asked to build with Pulse...

paulharris commented 1 year ago

If I move that cmake folder out of the way to hide those files, it still finds Pulse in /usr/lib, and OSS in /usr/include/x86_64-linux-gnu.

So it does build, but it sneakily links in extra stuff I didn't expect.

SpaceIm commented 1 year ago

duplicate of https://github.com/conan-io/conan-center-index/issues/13772

It's a side effect of CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in conan_toolchain.cmake. See https://github.com/conan-io/conan/issues/10387

openal recipe should be fixed to enforce find_package(PulseAudio REQUIRED MODULE) in upstream CMakeLists.txt. But actually pulseaudio is not even in requires of openal recipe, so there are more things to fix in the recipe (the build is not reproducible and dependencies are not under control).

paulharris commented 1 year ago

Wow yes this cmake/recipe needs a bit more work. I had a quick go here: https://github.com/conan-io/conan-center-index/commit/c9646a2ac909f29b7c538d535da14cb4444a9ab4 but I don't need OpenAL so I don't have the commitment to follow through on this PR.

At least with the patch, it builds with the system cmake files in place, but it will still find the system pulseaudio and other things.

I'd rather cmake is only able to scan the conan generators folder for finders, so no matter what is installed on the system, it'll work the same...

Alternatively, the project's cmake file has to be written carefully to avoid finding system finders ...