[CMake] Re: Trouble with libraries on MacOS X
Brandon J. Van Every
bvanevery at gmail.com
Fri Feb 23 12:46:14 EST 2007
Thomas Christian Chust wrote:
> I consider this seriously buggy behaviour. First of all I don't like it
> that the build system magically wipes out one of the library targets I
> ordered it to create.
See SET_TARGET_PROPERTIES in the docs.
"When a library is built CMake by default generates code to remove any
existing library using all possible names. This is needed to support
libraries that switch between STATIC and SHARED by a user option.
However when using OUTPUT_NAME to build a static and shared library of
the same name using different logical target names the two targets will
remove each other's files. This can be prevented by setting the
CLEAN_DIRECT_OUTPUT property to 1."
I haven't tried this approach in Chicken. I solved the problem by
putting the static libs in their own subdirectory.
The design is not ideal. Ideally, CMake would make collision decisions
based on the full name of the library, including prefixes, postfixes,
and suffixes. On Unixy toolchains it is standard drill that suffixes
distinguish shared vs. static libraries. On MSVC unfortunately it is
not; everything ends in .lib. Personally I think it would be acceptable
to have the MSVC generator die with an error message. The MSVC
buildmaster can either disambiguate with the various *_POSTFIX options,
name the libraries differently, or put libraries in separate directories.
Cheers,
Brandon Van Every
More information about the CMake
mailing list