[CMake] execute a script before and after configuration

David Cole david.cole at kitware.com
Fri Jan 20 22:26:05 EST 2012


On Friday, January 20, 2012, Michael Hertling <mhertling at online.de> wrote:
> On 01/20/2012 01:57 PM, Dominik Szczerba wrote:
>> Hi,
>>
>> I am building a big software framework on a cray system whereby during
>> cmake "configuration" phase I need to unload certain system modules
>> (so that some small test programs are allowed to run without
>> scheduler) and afterwards, before the actual build phase starts, I
>> need to load them back. Doing it manually is troublesome, because
>> sometimes typing "make" triggers cmake to re-run, and then re-build,
>> so there is no chance to load/unload the modules.
>>
>> So, how would I force one script to run when cmake is started and one
>> other script before build starts?
>>
>> Many thanks for any directions.
>>
>> Dominik
>
> You might use an EXECUTE_PROCESS() command at the beginning of your
> CMakeLists.txt to unload the modules, and another EXECUTE_PROCESS()
> at the end to reload them.
>
> Regards,
>
> Michael
> --
>
> 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
>

Doesn't the module switching involve setting environment variables? You're
going to have to do that before invoking CMake aren't you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120120/2604e8b3/attachment.htm>


More information about the CMake mailing list