Sign in to follow this  
TheComet

Ambiguity with search paths (when compiling and linking)

Recommended Posts

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.

Edited by TheComet

Share this post


Link to post
Share on other sites
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(). Edited by BitMaster

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this