[CMake] Cygwin & MinGW static and dynamic libs won't coexist

Brad King brad.king at kitware.com
Thu Aug 3 09:45:37 EDT 2006


Brandon J. Van Every wrote:

> Cygwin expected nomenclature is:
> 
> cygwhatever-xxx.dll - dynamic link lib where -xxx is a version number
> libwhatever.dll.a - import lib
> libwhatever.a - static lib
> 
> MinGW expected nomenclature is:
> 
> libwhatever.dll - dynamic link lib
> libwhatever.dll.a - import lib
> libwhatever.a - static lib
> 
> I have a target "chicken-exe" which links against a dynamic library 
> target "libchicken".
> I have a target "chicken-static" which links against a static library 
> target "libchicken-static".
> The OUTPUT_NAME of chicken-exe, libchicken, and libchicken-static is 
> "chicken".  Prefixes are added by CMake.  So for my problem, I expect 
> there is a conflict regarding the root OUTPUT_NAME.
> 
> On Cygwin and MinGW CMake 2.4.3, if I type "make chicken-exe", it builds 
> fine.  It also produces libchicken.dll.a and deletes libchicken.a.  If I 
> type "make chicken-static", it builds fine.  It also produces 
> libchicken.a and deletes libchicken.dll.a.  If I type "make," 
> chicken-exe builds fine and chicken-static dies with an error:

In order to support projects that use the BUILD_SHARED_LIBS switch to 
change between static and shared libraries, the clean rule used to wipe 
out a target before it is linked removes source files with all possible 
names for the library.  This is why one library is deleting the other.

I've just added a target property called CLEAN_DIRECT_OUTPUT that can be 
set on the two library targets to prevent them from deleting each other. 
  See the documentation in SET_TARGET_PROPERTIES in the CVS version of 
CMake.  We'll include this in 2.4.4.

-Brad



More information about the CMake mailing list