Thiago Macieira wrote:
> Since that's just an empty file and will produce hardly any symbols, 
> there's no need to link.

One solution is to build the sources in a static library.  The archiver
does not care about symbol resolution since it does not really link
anything:

ADD_LIBRARY(check_compile STATIC src1.cxx src2.cxx)

In order to avoid the time actually spent archiving you can remove the
object files from the link rule:

STRING(REGEX REPLACE "<OBJECTS[^>]*>" ""
       CMAKE_CXX_CREATE_STATIC_LIBRARY
       "${CMAKE_CXX_CREATE_STATIC_LIBRARY}")

which causes the target to be created as an empty archive for all the
Makefile generators.  This should be done in its own subdirectory though
so that the link rule is not broken for other directories.

For the VS IDE generators there does not seem to be a way to compile
sources without archiving them, but since the objects contain only a few
symbols they should not be too big.

-Brad
_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to