2010/12/16 Andreas Mohr <a...@lisas.de>:
> 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.

This is an interesting question.
Currently I think you are right there is no *builtin* way to know if your script
is being run from within CPack.

I think the feature is interesting and it is worth a feature request.
The solution is easy: make CPack defines something like CPACK_IS_RUNNING
variable and then you can do

IF(CPACK_IS_RUNNING) from within your script.

Builtin support for this needs [very small] patch.

Now you can emulate this feature by using a CPACK_PROJECT_CONFIG_FILE.
See the doc here:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29

The CPACK_PROJECT_CONFIG_FILE is loaded by CPack for each generator it
has to launch
so if you unconditionnally define

set(CPACK_IS_RUNNING 1)

in this file then CPACK_IS_RUNNING will be defined before your install
time script is runned.

I didn't tried but I think  it should work as expected.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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