If graphics/MesaLib is *not* installed:
% ~/pkg/sbin/pkg_info | grep MesaLib
I understand that Cmake finds the OpenGL framework provided by macOS:
% grep "OPENGL_gl_LIBRARY:" work/openttd-14.0/cmake-pkgsrc-build/CMakeCache.txt
OPENGL_gl_LIBRARY:FILEPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/OpenGL.framework
But if graphics/MesaLib is installed (but its buildlink3.mk is not the Makefile):
% ~/pkg/sbin/pkg_info | grep MesaLib
MesaLib-21.3.9nb4 Open source OpenGL implementation
Now Cmake finds the OpenGL implementation provided by pkgsrc:
% grep "OPENGL_gl_LIBRARY:" work/openttd-14.0/cmake-pkgsrc-build/CMakeCache.txt
OPENGL_gl_LIBRARY:FILEPATH=/Users/triaxx/pkg/lib/libGL.dylib
And the build step fails with the following error message:
ld: library 'GL' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is the right way to avoid CMake finding OpenGL path in LOCALBASE first?
MesaLib should not be installed on macOS at all. Just add something like:
.if ${OPSYS} != "Darwin"
.include "../../graphics/MesaLib/buildlink3.mk"
.endif
Kind regards,
Adam