[CMake] Clang on Cygwin don't build 'dll.a'

Thomas Nilsson thomas at junovagen.se
Sun Apr 3 17:38:33 EDT 2016


Thomas Nilsson skrev:
> I'm trying to build a CMake project using clang instead of gcc. The
> project is cross-platform and builds cleanly on Cygwin with gcc. With
> Clang it says:
>
> [ 33%] Built target X
> make[4]: *** No rule to make target 'X.dll.a', needed by 'X.exe'. Stop.
> CMakeFiles/Makefile2:1140: recipe for target 'tools/CMakeFiles/X/all' failed
>
> I don't know how to fix this, but I'm not completely sure that it's not
> my project that instructs CMake to do this (how would I know?).
>
> If not, is there a way to make CMake link directly against the .dll?
>
> /Thomas
> Cygwin64 on Windows 10 with CMake 3.3.2
>
>

This seems to be caused by the fact that clang command line for building 
shared libraries does not receive the "-Wl,--enable-auto-import" option, 
which gcc does.

For GCC this seems to happen in Modules/Platform/CYGWIN-GNU.cmake:53, 
but I can't figure out where this should be placed to fix it for clang.

Any pointers?

/Thomas


More information about the CMake mailing list