On Thu, May 13, 2010 at 3:04 PM, Alexander Neundorf <[email protected]
> wrote:

> On Thursday 13 May 2010, Benoit Thomas wrote:
> > Hello,
> >
> > Is there any way to know if my code is running script mode (cmake -P) or
> > normal mode ? I wanna do something like this:
>
> For a specific case this should be possible.
> You should be able to check e.g. whether CMAKE_C_COMPILER (or CXX) is true.
> Or
> whether <YourProjectName>_SOURCE_DIR exists. Or CMAKE_SIZE_OF_VOIDP.
> Something like that should work.
>

Just be careful: those variables, while they are not normally set during a
script run, there is nothing that prevents them from being set in a script
context. So: it's a heuristic which will work 99.99% of the time... but
there will be that 1 in 10,000 case where somebody is doing something silly
like: including some cmake file that actually sets one of these variables.

But you should be able to find something work-able until issue #2828 is
actually addressed someday....

:-)
David
_______________________________________________
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

Reply via email to