Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Ambiguity with search paths (when compiling and linking)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 TheComet   Crossbones+   -  Reputation: 1785

Like
0Likes
Like

Posted 12 June 2014 - 05:09 AM

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, 12 June 2014 - 05:12 AM.

YOUR_OPINION >/dev/null

Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4922

Like
0Likes
Like

Posted 12 June 2014 - 05:22 AM

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, 12 June 2014 - 05:25 AM.


#3 Tribad   Members   -  Reputation: 928

Like
0Likes
Like

Posted 12 June 2014 - 05:55 AM

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



#4 TheComet   Crossbones+   -  Reputation: 1785

Like
0Likes
Like

Posted 13 June 2014 - 03:09 AM

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


YOUR_OPINION >/dev/null




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS