[CMake] CMake 2.4.2 Cygwin shouldn't have -ldl

William A. Hoffman billlist at nycap.rr.com
Thu Jun 1 13:38:59 EDT 2006


At 01:22 PM 6/1/2006, Brandon J. Van Every wrote:
>Brad King wrote:
>>Brandon J. Van Every wrote:
>>>I built a CMake 2.4.2 for Cygwin from sources.  I used the "Unix linefeed" download, cmake-2.4.2.tar.gz.  I used an earlier Cygwin CMake package to build it.  Now I am using this Cygwin CCMake 2.4.2 to generate my Chicken build.  When it comes time to link a .dll, it fails with:
>>>
>>>Linking C shared library libchicken.dll
>>>/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
>>>-ldl
>>>collect2: ld returned 1 exit status
>>>make[2]: *** [libchicken.dll] Error 1
>>>make[1]: *** [CMakeFiles/libchicken.dir/all] Error 2
>>>make: *** [all] Error 2
>>
>>If libchicken is trying to link to -ldl this is probably because you are telling to do so somewhere in your CMakeLists.txt code.
>
>Hm!  You know, there is a conditional -ldl in there.  I haven't noticed that in a long time.  I wonder why it's giving this behavior on Cygwin when previously it didn't.  I will investigate.

There is a variable CMAKE_DL_LIBS, that you can use without an if.

 TARGET_LINK_LIBRARIES(chicken ... ${CMAKE_DL_LIBS})

-Bill



More information about the CMake mailing list