[CMake] Project being (unnecessarily) relinked
Bill Hoffman
bill.hoffman at kitware.com
Fri Sep 14 09:19:05 EDT 2007
Dizzy wrote:
> On Thursday 13 September 2007 15:08:30 you wrote:
>
>> Thinking out of the box, here is one way I solved this problem. Say
>> your first project builds a library Foo. Then install that library in
>> what ever location you want to install it. Then set an environment
>> variable "FOO_ROOT" that points to the top level install directory.
>> So typically you would install things in /usr/local/ (on a unix
>> machine), then "make install" should put libFoo.a in the "lib"
>> directory in /usr/local. That was all part 1.
>>
> <snip>
>
>> This type of setup will solve the "use absolute paths" where possible
>> that Bill Suggested. Not sure if it will solve the linking problem
>> though..
>>
>> Hope that helps explain some things.
>>
>
> What you are sugesting solves the problem for installable libraries (which
> were installed in a previous to "cmake time", the time where FIND_LIBRARY()
> runs). Problem with "convenience libraries" of a project is that they have
> not been built already when cmake runs for that project (so FIND_LIBRARY
> cannot find them). Using full paths to them (by using of CMAKE_BUILD_DIR and
> such variables) seems unportable (or maybe I miss something).
>
Full paths by the use of PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR and such
variables is very portable. If Cmake is building the library, then you
only need to use the target
name to find it.
-Bill
More information about the CMake
mailing list