[Cmake] FIND_LIBRARY : question about name

William A. Hoffman billlist at nycap.rr.com
Mon, 26 Apr 2004 11:35:52 -0400


OK, that is another issue altogether....

The Unix Makefiles was added to support the MinGw environment, but
does not look for the right library names.  Also, cygwin paths are not
understood by the windows CMakeSetup.   In short, for cygwin, the
CMakeSetup really is not going to work.   



-Bill


At 11:26 AM 4/26/2004, ibiris at genius.org.br wrote:
>OK
>
>I am trying to use the windows version of CMake in both windows and cygwin 
>environments. For windows I use the "NMake Makefiles" generator and for 
>cygwin the "Unix Makefiles" generator.
>
>Here is a little diagram of dependencies
>
>TOP-LEVEL 
>        ---- COMPONENT X
>                Makes library libx.a or x.lib (cygwin/windows 
>respectively)
>
>        ---- COMPONENT Y
>                Makes library liby.so or y.dll + y.lib. This library 
>requires to link to the library in component X
>
>
>
>I tried to use ADD_DEPENDENCY but it did not work (I did not get the 
>library in component X). So I hacked a solution trying to build the 
>library in component A when I do cmake in component Y. I used the 
>following bit of code in the CMakeLists.txt that is responsible for making 
>the library in ComponentY.
>
>
>---------------
>FIND_LIBRARY(libX NAMES x PATHS 
>${COMPONENTY_SOURCE_DIR}/../ComponentX/build/bin)
>
>#If the library in component X does not exist
>IF( NOT libX)
>
># Warn some
>  MESSAGE( "WARNING:: missing library X for generator ${CMAKE_GENERATOR}")
>  MESSAGE( "WARNING:: will try to create it in 
>${COMPONENTY_SOURCE_DIR}/../ComponentX/build")
>
># try to get it created
># make directory build 
>  MAKE_DIRECTORY(${COMPONENTY_SOURCE_DIR}/../ComponentX/build)
>
>#do cmake with the same generator as used for componentY
>  EXEC_PROGRAM(${CMAKE_COMMAND} 
>${COMPONENTY_SOURCE_DIR}/../ComponentX/build ARGS -G"${CMAKE_GENERATOR}" 
>..)
>
># Do make or nmake
>  EXEC_PROGRAM(${CMAKE_MAKE_PROGRAM} 
>${COMPONENTY_SOURCE_DIR}/../ComponentX/build)
>
># try to find the library again ... if not there cmake fails this time for 
>sure
>  FIND_LIBRARY(libX NAMES x PATHS 
>${COMPONENTY_SOURCE_DIR}/../ComponentX/build/bin)
>ENDIF(NOT libX)
>---------------
>
>
>I do not claim this code is the best but I expected it to work at least 
>until some better solution was worked out. On cygwin (with the contents of 
>ComponentX/build directory completely removed) it goes on to build 
>ComponentX library successfully, while it is configuring the component Y 
>stuff, but the second 'find_library' fails. On windows it does the build 
>of ComponentX library and the second  'find_library' works fine. 
>
>I also tried varying the names of the libraries in windows and cygwin to 
>see if there is a difference, but it did not work. I suspect now that it 
>must be the fact that I am using windows cmake (1.8.3). I expected that 
>cmake would find the correct library names depending the type of the 
>generator.
>
>
>
>
>----
>Ilias Biris, Ph.D.
>Senior Researcher
>Genius Instituto de Tecnologia
>TEL: +55 (0)92 6146503
>FAX: +55 (0)92 6133144
>http://www.genius.org.br/
>
>
>
>
>
>"William A. Hoffman" <billlist at nycap.rr.com>
>Sent by: cmake-admin at www.cmake.org
>26/04/2004 11:02
>
> 
>        To:     ibiris at genius.org.br, cmake at www.cmake.org
>        cc: 
>        Subject:        Re: [Cmake] FIND_LIBRARY : question about name
>
>
>The cygwin cmake looks for libx for me?
>Can you give an example? 
>
>
>If this did not work, then cmake itself would not build under cygwin,
>since it needs to find curses and form libraries:
>
>CURSES_LIBRARY:FILEPATH=/usr/lib/libcurses.a
>//Where can the form library be found
>FORM_LIBRARY:FILEPATH=/usr/lib/libform.a
>
>-Bill
>
>At 10:15 AM 4/23/2004, ibiris at genius.org.br wrote:
>
>
>
>
>>Hello folks,
>>
>>recently I tried to use FIND_LIBRARY to check if a library required to
>>build  another library is already available or it has to be built first.
>>
>>The problem I have is that the name of the library is libx.a in cygwin 
>but
>>just x.lib on windows. Using just
>>
>>FIND_LIBRARY(varname NAMES x PATHS < bunch o' paths here> )
>>
>>works ok on windows but on cygwin it causes an error, since it cannot 
>find
>>the libx (instead of x). Can someone verify if I need to search for a
>>different name in  cygwin / windows / Linux?  I would expect that 'x' 
>marks
>>the name that is used for linking so it should look for x.lib on windows
>>and libx.a for linux/cygwin.
>>
>>Maybe I am missing something so your help would be greatfully 
>appreciated.
>>
>>Kind regards,
>>
>>----
>>Ilias Biris, Ph.D.
>>Senior Researcher
>>Genius Instituto de Tecnologia
>>TEL: +55 (0)92 6146503
>>FAX: +55 (0)92 6133144
>>http://www.genius.org.br/
>>**************************************************************************************************
>>
>>O conteúdo desse e-mail ou de seus anexos são confidenciais e restritos 
>ao 
>>destinatário da mensagem.
>>Se você recebeu esse e-mail por engano, por favor notifique o remetente 
>>imediatamente e não faça cópias ou distribua seu conteúdo para ninguém.
>>
>>**************************************************************************************************
>>
>>The contents of this email and any attachments are confidential.
>>They are intended for the named recipient(s) only.
>>If you have received this email in error please notify the system manager 
>or  the 
>>sender immediately and do not disclose the contents to anyone or make 
>copies.
>>
>>**************************************************************************************************
>>_______________________________________________
>>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
>
>
>**************************************************************************************************
>
>O conteúdo desse e-mail ou de seus anexos são confidenciais e restritos ao 
>destinatário da mensagem.
>Se você recebeu esse e-mail por engano, por favor notifique o remetente 
>imediatamente e não faça cópias ou distribua seu conteúdo para ninguém.
>
>**************************************************************************************************
>
>The contents of this email and any attachments are confidential.
>They are intended for the named recipient(s) only.
>If you have received this email in error please notify the system manager or  the 
>sender immediately and do not disclose the contents to anyone or make copies.
>
>**************************************************************************************************
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake