[CMake] TRY_LINK and CheckCXXSourceLinks ??

David Cole david.cole at kitware.com
Tue Jan 11 11:20:06 EST 2011


Yes... this confused me when I first encountered it as well.

TRY_COMPILE is misnamed in CMake.

In functionality, it's actually a TRY_LINK operation.


On Tue, Jan 11, 2011 at 10:59 AM, Marcel Loose <loose at astron.nl> wrote:

> Hi David,
>
> I guess you're right. Further playing with CheckCXXSourceCompiles and
> investigating the generated CMakeLists.txt file led me to the conclusion
> that the link step is indeed also performed. I was led astray by the
> name of the command and my notion that it wraps TRY_COMPILE. Also my
> background in the GNU Autotools, which has TRY_COMPILE, TRY_LINK and
> TRY_RUN, didn't really help. Sorry for the noise.
>
> Best regards,
> Marcel Loose.
>
> --
> Marcel Loose
> Senior Software Engineer, Computing Group R&D, Astron, the Netherlands
> >>> David Cole  11-01-11 13:44 >>>
> Doesn't CheckCXXSourceCompiles link?
>
> I think there's no way to avoid the link in a try_compile...
>
>
> On Tue, Jan 11, 2011 at 5:49 AM, Marcel Loose  wrote:
>
> > Hi all,
> >
> > I was wondering how I can check whether I can successfully compile and
> > link an executable, without actually running it.
> CheckCXXSourceCompiles
> > checks whether I can compile the code, however linking could still
> fail.
> > CheckCXXSourceRuns OTOH also tries to run the executable, which causes
> > problems when cross-compiling. So, why is there no
> CheckCXXSourceLinks?
> >
> > Best regards,
> > Marcel Loose.
> >
> >
> >
> > --
> > Marcel Loose
> > Senior Software Engineer, Computing Group R&D, Astron, the Netherlands
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110111/25b2c91f/attachment.htm>


More information about the CMake mailing list