I’ve set LIBRARY_SEARCH_PATHS to /opt/local/lib, and verified that the library in question is there (I’m linking to GLEW):
$ls /opt/local/lib libGLEW.1.5.1.dylib libfreetype.a libz.a libGLEW.1.5.dylib libfreetype.dylib libz.dylib libGLEW.a libfreetype.la pkgconfig libGLEW.dylib libz.1.2.3.dylib libfreetype.6.dylib libz.1.dylib
but Xcode gives me the linker error
library not found for -lGLEW
I’m generating the Xcode project with CMake, so I don’t want to explicitly modify the Xcode project (if someone suggests adding it as a framework, or something like that). Xcode recognizes USER_HEADER_SEARCH_PATHS fine (as in this question); why doesn’t it work here?
Perhaps adding something like this to your CMakeLists.txt?
Where myprogram is the name of the target executable that needs to link with the library. You would replace the … with the other libraries you are using on that executable.
This way CMake would handle the library path details for you.