Ambiguity with search paths (when compiling and linking)

Started by
2 comments, last by TheComet 9 years, 10 months ago

Simple question really.

I'm compiling and installing all of the dependencies of a project to a custom location (project_root/build.dep). If one of the dependencies happens to exist on the host system as well, for instance python, how can I force the build environment to use project_root/build.dep/include/Python instead of /usr/include/Python, and link against project_root/build.dep/lib/libpython instead of /usr/lib/libpython?

I've used:


export CFLAGS=project_root/build.dep/include
export LDFLAGS=project_root/build.dep/lib

But it's still favouring the versions in PATH.

NOTE: Build systems in use by the dependencies are CMake, libtool, and bjam.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty
Advertisement
I don't know how you use CMake, but in my use cases CMake would be responsible for finding which library to link, including the full path. Most libraries will find themselves using for example find_library and the documentation should include how the search happens and how you can modify it to deviate from the default.

Edit: A very simple solution might be to manually SET(<mylibrary>_LIBRARY "${CMAKE_SOURCE_DIR}/path/to/lib" CACHE path "my comment") for all relevant CMake variables instead of using find_package().

you should have a look on the compiler options --sysroot --isysroot and the like.

Thanks for the help, got it working by manipulating the CMake find scripts to find local packages before it finds system wide packages.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

This topic is closed to new replies.

Advertisement