[CMake] How to detect whether CMake scripts are executing under / within CPack environment?

Andreas Mohr andi at lisas.de
Thu Dec 16 03:34:41 EST 2010


Hi,

[subject formulated for best keyword search impact]

forgive me for the possibly dumb question,
but since cpack of course includes executing the "make install" step
I'd like to know how to possibly detect this within CMake code.
My build is capable of launching an external script
to pop up a "build complete" message, which then of course
unhelpfully also occurs during cpack -G DEB (thus completely stopping the
packaging due to non-parallel build execution in this environment),
thus it would be useful to automatically turn it off in such cases.
Of course a potential solution might actually turn out to be
generator-specific (e.g. Makefile). :-P
I'm afraid since CPack is likely executing a generated CMake
environment, detection is difficult or even impossible.

Several varied Google searches didn't turn up much.

Andreas Mohr


More information about the CMake mailing list