<div class="gmail_quote">On Thu, May 13, 2010 at 3:04 PM, Alexander Neundorf <span dir="ltr"><<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thursday 13 May 2010, Benoit Thomas wrote:<br>
> Hello,<br>
><br>
> Is there any way to know if my code is running script mode (cmake -P) or<br>
> normal mode ? I wanna do something like this:<br>
<br>
</div>For a specific case this should be possible.<br>
You should be able to check e.g. whether CMAKE_C_COMPILER (or CXX) is true. Or<br>
whether <YourProjectName>_SOURCE_DIR exists. Or CMAKE_SIZE_OF_VOIDP.<br>
Something like that should work.<br></blockquote></div><br>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.<br>
<br>But you should be able to find something work-able until issue #2828 is actually addressed someday....<br><br>:-)<br>David<br><br>