[CMake] CHECK_CXX_SOURCE_COMPILES attempts linking

Alexander Neundorf a.neundorf-work at gmx.net
Sat Sep 5 14:25:42 EDT 2009


On Saturday 05 September 2009, you wrote:
> Alexander Neundorf wrote:
> > On Thursday 03 September 2009, John Smith wrote:
> >> It seems that CHECK_CXX_SOURCE_COMPILES attempts to link the object
> >> files into an executable:
> >
> > Yes. Sometimes having it only compile but not link would be nice, but
> > that's not the case.
>
> So, this is not by design, instead it is an artifact of the implementation?
>
> > You can specifiy libraries to link to, so it should be possible to get it
> > linking.
>
> That is true. But what is the obstacle to implementing the macro such
> that it just does compilation (as the name suggests) and not compilation
> and linking?

(without checking) I think it creates a small project, where the 
CMakeLists.txt uses add_executable(). This links.
There is not cmake command which only compiles, but not links. 
add_library(STATIC) may be close.

Alex


More information about the CMake mailing list