[CMake] execute a script before and after configuration

Dominik Szczerba dominik at itis.ethz.ch
Sat Jan 21 04:50:22 EST 2012


>>> 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.

Will try, thanks for the hint!

>> Doesn't the module switching involve setting environment variables? You're
>> going to have to do that before invoking CMake aren't you?

No, it means calling something like "module un/load XXXX" from command line.

> May be Dominik can explain this
> "so that some small test programs are allowed to run without
> scheduler"
> a little more?

Simplest example, suppose I need to compute epsilon and save it in
myconfig.h. To this end I need to run a small program and I use
TRY_RUN for that. But by default you are not allowed to run any
programs on the login node, all compiled execs must go through a
scheduler. This is not what I want for a test program. To allow it to
run on a login node during cmake configuration I must first unload a
certain module, so it is compiled differently to run directly on the
calling machine. But right before the actual build of my application
starts it must be loaded again, else I would not be able to submit my
job with the scheduler because it would be compiled in run-locally
node, which is not what I want for my application.


Regards
Dominik


More information about the CMake mailing list