[Cmake] Problems with Library Dependencies

William A. Hoffman billlist at nycap.rr.com
Thu, 08 Apr 2004 10:25:39 -0400


OK, I suppose this might be a feature/bug.   I guess
it was assumed that FIND_LIBRARY would be used to find
system libraries that do not change much.   However, there
is not really a good technical reason for not adding the extra
depend information, it is not like it would make the makefile
much bigger.

-Bill

>I try to describe my problem more concrete:
>
>If you add a external library(with absolute path) with the
>TARGET_LINK_LIBRARIES-Command, there is no myprog_DEPEND_LIBS in the
>Makefile. (Even if you use the ADD_DEPENDENCIES-Command after).
>
>What is the reason for this behavior?
>Has it a technical reason, is it a bug, or is it simple not implemented?
>
>Thanks,
>Bernhard
>
>
>-----Original Message-----
>From: cmake-admin at www.cmake.org [mailto:cmake-admin at www.cmake.org] On Behalf
>Of William A. Hoffman
>Sent: Thursday, April 08, 2004 3:11 PM
>To: Bernhard Zach; cmake at www.cmake.org
>Subject: RE: [Cmake] Problems with Library Dependencies
>
>If you build just in the "Executable" directory, cmake should re-link
>the executable if the library has changed, if the library is part of the
>cmake build (not found with FIND_LIBRARY, but part of wholeProgram).
>However,
>if source code for libOne changes, and you run make in Executable then
>the depends for libOne sources are not in the Executables directory, so it
>will not jump over to the libOne directory and build it.   
>
>-Bill
>
>
>At 04:17 AM 4/8/2004, Bernhard Zach wrote:
>>> Is the library you are finding built by cmake?
>>Yes ist is.
>>
>>Our directory structure is something like this:
>>-wholeProgram (CMakeLists.txt with only SUBDIRS-Commands)
>>  |-category1
>>     -libOne (CMakeLists.txt)
>>     -libTwo (CMakeLists.txt)
>>  |-category2
>>     -libThree (CMakeLists.txt)
>>  |-binaries
>>     -Executable (CMakeLists.txt)
>>
>>The Executable is linked to all the libs in the Tree.
>>
>>All Libraries are installed to a specific "private" Directory. If the
>needed
>>library is not there, it should be taken from a "master" Directory, (which
>>is nightly build)
>>
>>There is no Problem if you build in the "wholeProgram"-Directory, because
>>CMake knows all the Libraries.
>>
>>But because we have many of them, it should be possible just to build in
>the
>>"Executable"-Directory. In this case at configuration time (from cmake)
>it's
>>possible to determine which library the binary should link, the private
>lib,
>>or if not present, the master lib.
>>And in that case it's important to know if any of the libraries changed, at
>>the next make-command.
>>
>>May you have any suggestions for a workaround of this problem?
>>
>>Thanks a lot,
>>Bernhard
>>
>>
>>-----Original Message-----
>>From: cmake-admin at www.cmake.org [mailto:cmake-admin at www.cmake.org] On
>Behalf
>>Of William A. Hoffman
>>Sent: Wednesday, April 07, 2004 3:33 PM
>>To: Bernhard Zach; cmake at www.cmake.org
>>Subject: RE: [Cmake] Problems with Library Dependencies
>>
>>Add it as a feature request in the bug tracker.
>>However, I am a bit confused by your comment that your source
>>is too big for one Makefile.   You can have SUBDIRS in cmake, and
>>as long as the ADD_LIBRARY is within the project all the depend stuff
>>will work just fine.   Is the library you are finding built by cmake?
>>
>>-Bill
>>
>>
>>At 02:01 AM 4/7/2004, Bernhard Zach wrote:
>>>Are there plans for changing this behavior?
>>>
>>>We would really need such a feature, because our source is too big to
>build
>>>it all in one Makefile.
>>>
>>>At least a FIND_LIBRARY/ADD_DEPENDENCIES combination should work.
>>>
>>>Thanks for your help,
>>>Bernhard
>>>
>>>-----Original Message-----
>>>From: cmake-admin at www.cmake.org [mailto:cmake-admin at www.cmake.org] On
>>Behalf
>>>Of William A. Hoffman
>>>Sent: Tuesday, April 06, 2004 1:57 PM
>>>To: Bernhard Zach; cmake at www.cmake.org
>>>Subject: Re: [Cmake] Problems with Library Dependencies
>>>
>>>CMake only depends on libraries that it can build.   You can
>>>link other libraries, but right now it does not depend on them.
>>>So, if there is not an ADD_LIBRARY in the project, the library
>>>will not be in the DEPEND_LIBS.
>>>
>>>-Bill
>>>
>>>
>>>At 04:17 AM 4/6/2004, Bernhard Zach wrote:
>>>>Hi all,
>>>>I hope somebody could help me:
>>>>
>>>>It seems that the Makefile generators have Problems to generate correct
>>>>Library dependencies. 
>>>>The line in the Makefile looks like this:
>>>>myprog_DEPEND_LIBS =
>>>>
>>>>In my CMakeLists.txt:
>>>>FIND_LIBRARY(LibFile mylib ${path1} ${path2})
>>>># do some error checking here...
>>>>
>>>># link the library with absolute path to my binarie
>>>>TARGET_LINK_LIBRARIES (myprog ${LibFile})
>>>>
>>>>The only way I got something in my "myprog_DEPEND_LIBS" is, when the
>>>"mylib"
>>>>is build at the same time (both dirs with SUBDIR-Command)
>>>>
>>>>I've tried it under Linux and Windows(nmake).
>>>>I also played with the ADD_DEPENDENCIES-Command with no result.
>>>>
>>>>Did I misunderstood something from the Cmake-concept?
>>>>
>>>>Thanks for some help,
>>>>Bernhard
>>>>
>>>>_______________________________________________
>>>>Cmake mailing list
>>>>Cmake at www.cmake.org
>>>>http://www.cmake.org/mailman/listinfo/cmake 
>>>
>>>_______________________________________________
>>>Cmake mailing list
>>>Cmake at www.cmake.org
>>>http://www.cmake.org/mailman/listinfo/cmake
>>>
>>>_______________________________________________
>>>Cmake mailing list
>>>Cmake at www.cmake.org
>>>http://www.cmake.org/mailman/listinfo/cmake 
>>
>>_______________________________________________
>>Cmake mailing list
>>Cmake at www.cmake.org
>>http://www.cmake.org/mailman/listinfo/cmake
>>
>>_______________________________________________
>>Cmake mailing list
>>Cmake at www.cmake.org
>>http://www.cmake.org/mailman/listinfo/cmake 
>
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake