[CMake] ADD_COMPILE_TEST macro

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 12 07:10:34 EST 2008


On Tuesday 12 February 2008, Mathieu Malaterre wrote:
> On Feb 11, 2008 6:45 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> > Alexander Neundorf wrote:
> > > On Monday 11 February 2008, Mathieu Malaterre wrote:
> > >> Hi there,
> > >>
> > >>   I would like to know if anyone has written a ADD_COMPILE_TEST macro
> > >> for cmake. Basically I would like to check that some template
> > >> instantiation should not compile, while other should. I tried quickly
> > >> doing cmake -P + TRY_COMPILE but I am getting an error :
> > >>
> > >>    Command TRY_COMPILE not scriptable
> > >>
> > >>   Code can be found here:
> > >
> > > Maybe you want CHECK_CXX_SOURCE_COMPILES ? It comes with cmake.
> >
> > That won't help, as it is still not going to be accessible from a cmake
> > -P script.   Why are you doing this as a -P script and not part of the
> > build?
>
> This is a test... I need to run it just like a normal test. I know
> this sound weird to check for something that do not compile. The
> simpliest case is when I need to trigger a static assert. Another
> example could be for ITK to check that their itkConceptChecking are
> actually working: Luis are you doing that ?
>

Yes, I think you want to use CHECK_CXX_SOURCE_COMPILES() in your cmake files.

Alex


More information about the CMake mailing list