Re: [CMake] execute a script before and after configuration
On 01/21/2012 11:28 AM, Dominik Szczerba wrote: On Sat, Jan 21, 2012 at 10:50 AM, Dominik Szczerba domi...@itis.ethz.ch wrote: 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! Unfortunately, it does not work. Unloading the module via a call to a bash script only unloads it for this script's process - the test run is not affected. Instead of calling the script I tried sourcing it (like 'source script', so the whole current session is affected) but this in turn seems to somehow silently do nothing, it does not even seem to be called. Still dead end, any more ideas? It would be nice to have a general elegant solution for cases where user is not allowed to directly run their programs on the current node. Similar scenario will arise for executing tests - currently make test fails because the tests are built for the scheduler so will not run locally. Regards, Dominik If I understand correctly - ATM, I've no access to a Cray machine, so I can't investigate immediately - the modules are unloaded/reloaded for the current process and its children only, but not for the CMake process where it is actually needed, right? If so, and provided you can figure out how to unload/reload the modules by C program code, you might use the hardly deployed LOAD_COMMAND(), look here: # CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(MODULES C) SET(CMAKE_VERBOSE_MAKEFILE ON) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) ADD_LIBRARY(UnloadModules MODULE EXCLUDE_FROM_ALL UnloadModules.c) SET_TARGET_PROPERTIES(UnloadModules PROPERTIES OUTPUT_NAME cmUnloadModules) FIND_LIBRARY(UNLOAD_MODULES_LIBRARY cmUnloadModules ${CMAKE_BINARY_DIR}) ADD_LIBRARY(ReloadModules MODULE EXCLUDE_FROM_ALL ReloadModules.c) SET_TARGET_PROPERTIES(ReloadModules PROPERTIES OUTPUT_NAME cmReloadModules) FIND_LIBRARY(RELOAD_MODULES_LIBRARY cmReloadModules ${CMAKE_BINARY_DIR}) ADD_CUSTOM_TARGET(ModulesLoading) ADD_DEPENDENCIES(ModulesLoading UnloadModules ReloadModules) IF(UNLOAD_MODULES_LIBRARY AND RELOAD_MODULES_LIBRARY) LOAD_COMMAND(UnloadModules ${CMAKE_BINARY_DIR}) MESSAGE(UnloadModules: ${CMAKE_LOADED_COMMAND_UnloadModules}) UNLOAD_MODULES() EXECUTE_PROCESS( COMMAND sh -c echo \CMake process: \$(pidof cmake)\) ENDIF() # Do usual stuff here. IF(UNLOAD_MODULES_LIBRARY AND RELOAD_MODULES_LIBRARY) LOAD_COMMAND(ReloadModules ${CMAKE_BINARY_DIR}) MESSAGE(ReloadModules: ${CMAKE_LOADED_COMMAND_ReloadModules}) RELOAD_MODULES() EXECUTE_PROCESS( COMMAND sh -c echo \CMake process: \$(pidof cmake)\) ENDIF() /* UnloadModules.c: */ #include cmCPluginAPI.h #include unistd.h #include stdio.h void UnloadModulesInit(cmLoadedCommandInfo *); static int initialpass(void *, void *, int, char *[]); void UnloadModulesInit(cmLoadedCommandInfo *info) { info-Name = UNLOAD_MODULES; info-InitialPass = initialpass; } static int initialpass(void *i, void *f, int argc, char *argv[]) { printf(Unloading modules for process: %d\n,getpid()); return !0; } /* ReloadModules.c: */ #include cmCPluginAPI.h #include unistd.h #include stdio.h void ReloadModulesInit(cmLoadedCommandInfo *); static int initialpass(void *, void *, int, char *[]); void ReloadModulesInit(cmLoadedCommandInfo *info) { info-Name = RELOAD_MODULES; info-InitialPass = initialpass; } static int initialpass(void *i, void *f, int argc, char *argv[]) { printf(Reloading modules for process: %d\n,getpid()); return !0; } The cmCPluginAPI.h header is the one from the CMake code base. The basic idea is that the new commands are executed in the context of the CMake process and, thus, can influence the latter, and this is not true for commands spawned by EXECUTE_PROCESS(). As long as the {Un,Re} loadModules targets aren't built, everything works as usual, but after make ModulesLoading, a reconfiguration invokes the UNLOAD_MODULES() and RELOAD_MODULES() commands which exemplarily shows the PID of the CMake process. Therefore, if you manage to unload/reload the modules via the two initialpass() functions, this might be a practicable way. Refer to [1] for more information about such LOAD_COMMAND() plugins. Alternatively, if it's possible to unload/reload the modules for an arbitrary process, e.g. by module -p PID un/load , you might use the above-noted example's means to find out the PID of the CMake process and use it with EXECUTE_PROCESS(). A final remark: If I use the following executable CMake script #!/bin/sh if [ $1 != -E ]; then echo Unloading modules cmake -DCMAKE_COMMAND=$0 $@ echo Reloading modules else cmake $@ fi for the initial configuration, I can see the {Un,Re}loading modules messages appearing around each further automatic reconfiguration, e.g. after touching CMakeLists.txt and rebuilding. Thus, Eike's
Re: [CMake] execute a script before and after configuration
I now see your point about changed env, sorry, I misunderstood you before. Indeed module load/unload changes the env, but the changes are excessive, involving include and linking paths for the currently loaded compilers (and there can be a few...) and many other switches involving paths to packages with explicit versions. It will be very difficult - and very unsafe - to write - and maintain! - a solution basically replicating the complexity that module load/unload hides. I hope there is some way to run cmake as a shell process or to somehow make some use of cross-compiling. Unfortunately, I do not know how, and I do not know any other poor guy whose complex software platform must build and run on both Windows and Cray to ask advice ;) Regarding testing functionality, I think a better workaround than an external project is simply two builds, one for the scheduler and one for the local testing. It's still annoying and time consuming for a big project, but I can live with that for the moment - unlike try_run unfortunately. One workaround for it that I possibly see is to delegate all try_run tests to python scripts. The problems here are that python is not always available on all platforms, and that in some cases it is not easy to do, e.g. when testing FPU accuracy. Regards, Dominik On Sat, Jan 21, 2012 at 8:11 PM, Eric Noulard eric.noul...@gmail.com wrote: 2012/1/21 Dominik Szczerba domi...@itis.ethz.ch: Running something from the command line does not mean it doesn't change the environment. Would you try $ env env1.txt $ module unload sysmodule_you_dont_want $ env env2.txt $ cmake -E compare_files env1.txt env2.txt I'd be surprise if nothing changed but I may be wrong. You are of course right, but this is not the scenario here. If you put module un/load XXX into a bash script, and call it from command line, it will only modify the env for this script/process. On the return your original env will not be changed. The very same scenario is happening with CMake. To change it, you need to source your script, but that is what seems to do nothing with cmake. Yes that's precisely the point CMake is not behaving like a shell at ALL with respect to env var. Re-read my other message. When cmake executes a command (using e.g. execute_process) it forks that is a NEW process which is a child of current cmake process is created, then the command/executable is run within the child (or replace the child http://en.wikipedia.org/wiki/Fork-exec) then the child terminates and CMake continue with other command with may be other child process. So when you COMMAND module unload blah this only affect the current child. That's the same difference between sourcing a script and running it with CMake you have no way to source a shell script because CMake is not the shell. From within CMake you source a cmake script (just include it) but not a shell script (which seems to be the machinery behind the 'module' command). What you can do however is to identify which environment change did the module unload do and then do the same with cmake. You may be able to monitor the change from cmake using a shell script which does: env file1 module unload env file2 diff file1 file2 -- then process the diff ouput with some cmake script en reproduce the environnement change using set(ENV{EnvVarName} newValue) -- 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
Re: [CMake] execute a script before and after configuration
2012/1/21 David Cole david.c...@kitware.com: On Friday, January 20, 2012, Michael Hertling mhertl...@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? As far as I remember (not used cray modules for ages) yes, there are env var modification. There is (at least) one similar tool not dedicated to Cray machine, which works the same way. http://modules.sourceforge.net/ Usually the main goal is to be able to install several version of softwares on the very same machine which is shared by many users and then offer each user a way to select the version of each installed tool. May be Dominik can explain this so that some small test programs are allowed to run without scheduler a little more? Does it mean you have to unload some module in order to run without using PBS (http://en.wikipedia.org/wiki/Portable_Batch_System) or something similar? Does this impact try_run or can't you use something like execute_process(module unload whatever testme this ) normally inside the exexcute_process you don't need module load again because the executed process has been forked. This should be verified though. -- 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
Re: [CMake] execute a script before and after configuration
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 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 -- 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
Re: [CMake] execute a script before and after configuration
On Sat, Jan 21, 2012 at 10:50 AM, Dominik Szczerba domi...@itis.ethz.ch wrote: 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! Unfortunately, it does not work. Unloading the module via a call to a bash script only unloads it for this script's process - the test run is not affected. Instead of calling the script I tried sourcing it (like 'source script', so the whole current session is affected) but this in turn seems to somehow silently do nothing, it does not even seem to be called. Still dead end, any more ideas? It would be nice to have a general elegant solution for cases where user is not allowed to directly run their programs on the current node. Similar scenario will arise for executing tests - currently make test fails because the tests are built for the scheduler so will not run locally. Regards, Dominik -- 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
Re: [CMake] execute a script before and after configuration
2012/1/21 Dominik Szczerba domi...@itis.ethz.ch: 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 from command line. Dominik, Running something from the command line does not mean it doesn't change the environment. Would you try $ env env1.txt $ module unload sysmodule_you_dont_want $ env env2.txt $ cmake -E compare_files env1.txt env2.txt I'd be surprise if nothing changed but I may be wrong. -- 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
Re: [CMake] execute a script before and after configuration
2012/1/21 Dominik Szczerba domi...@itis.ethz.ch: 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. This looks like kind of cross-compiling problem. see cmake --help-command try_run. In your case, the host being the login/frontend node while the target is the parallel nodes. The only difference here is that the compiler switch is probably hidden by the module call. May be that if you can wrap all your small tests to be tried-run on the login node in a separate project you can execute_process(COMMAND your-shell-script.sh ${CMAKE_SOURCE_DIR}/path/you/want OUTPUT_VARIABLE TO_BE_PROCESSED) the your-shell-script.sh would do something like: module unload systemmod cmake --build $1 cmake -P /path/to/your/separate/project/collect_result.cmake after that you get the result oif the test done with the systemmod unloaded in TO_BE_PROCESSED. Others may correct me if I'm wrong but each command is processed by a forked child so that any modification (w.r.t. the environment) in the child is lost in the parent process and the following other COMMAND if any. Thus you should really do it by hand or wrap-up a separate project which will do the testing. Note that this helper project may enable you install some helper executable (compiled for the login-node execution) inside the build tree of the to-be-configured project such that you can actually run those executable during the configure process of the main project. You may be able to achieve that [more] easily using ExternalProject_Add see cmake --help-module ExternalProject By the way you may not be the only person to use CMake on Cray machine how do the others do? Do they use some try_run as well? -- 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
Re: [CMake] execute a script before and after configuration
Running something from the command line does not mean it doesn't change the environment. Would you try $ env env1.txt $ module unload sysmodule_you_dont_want $ env env2.txt $ cmake -E compare_files env1.txt env2.txt I'd be surprise if nothing changed but I may be wrong. You are of course right, but this is not the scenario here. If you put module un/load XXX into a bash script, and call it from command line, it will only modify the env for this script/process. On the return your original env will not be changed. To change it, you need to source your script, but that is what seems to do nothing with cmake. Thanks Dominik -- 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
Re: [CMake] execute a script before and after configuration
2012/1/21 Dominik Szczerba domi...@itis.ethz.ch: Running something from the command line does not mean it doesn't change the environment. Would you try $ env env1.txt $ module unload sysmodule_you_dont_want $ env env2.txt $ cmake -E compare_files env1.txt env2.txt I'd be surprise if nothing changed but I may be wrong. You are of course right, but this is not the scenario here. If you put module un/load XXX into a bash script, and call it from command line, it will only modify the env for this script/process. On the return your original env will not be changed. The very same scenario is happening with CMake. To change it, you need to source your script, but that is what seems to do nothing with cmake. Yes that's precisely the point CMake is not behaving like a shell at ALL with respect to env var. Re-read my other message. When cmake executes a command (using e.g. execute_process) it forks that is a NEW process which is a child of current cmake process is created, then the command/executable is run within the child (or replace the child http://en.wikipedia.org/wiki/Fork-exec) then the child terminates and CMake continue with other command with may be other child process. So when you COMMAND module unload blah this only affect the current child. That's the same difference between sourcing a script and running it with CMake you have no way to source a shell script because CMake is not the shell. From within CMake you source a cmake script (just include it) but not a shell script (which seems to be the machinery behind the 'module' command). What you can do however is to identify which environment change did the module unload do and then do the same with cmake. You may be able to monitor the change from cmake using a shell script which does: env file1 module unload env file2 diff file1 file2 -- then process the diff ouput with some cmake script en reproduce the environnement change using set(ENV{EnvVarName} newValue) -- 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
[CMake] execute a script before and after configuration
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 -- 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
Re: [CMake] execute a script before and after configuration
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. What about overriding CMAKE_COMMAND in your CMakeCache.txt with a script that does your module fiddling, run cmake, and fiddle back? Eike -- 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
Re: [CMake] execute a script before and after configuration
Nice idea, but this internal variable gets overwritten and resets back to the system cmake... any ideas? Thanks Dominik On Fri, Jan 20, 2012 at 2:06 PM, Rolf Eike Beer e...@sf-mail.de 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. What about overriding CMAKE_COMMAND in your CMakeCache.txt with a script that does your module fiddling, run cmake, and fiddle back? Eike -- 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 -- 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
Re: [CMake] execute a script before and after configuration
Hmmm I managed to force it by cmake -DCMAKE_COMMAND=/users/dsz/bin/mycmake and it indeed appears now in the cache file, but it does not seem to unload/reload the modules, so I guess it is not used instead of cmake... else how can I check if it is invoked? Thanks a lot On Fri, Jan 20, 2012 at 2:24 PM, Dominik Szczerba domi...@itis.ethz.ch wrote: Nice idea, but this internal variable gets overwritten and resets back to the system cmake... any ideas? Thanks Dominik On Fri, Jan 20, 2012 at 2:06 PM, Rolf Eike Beer e...@sf-mail.de 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. What about overriding CMAKE_COMMAND in your CMakeCache.txt with a script that does your module fiddling, run cmake, and fiddle back? Eike -- 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 -- 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
Re: [CMake] execute a script before and after configuration
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
Re: [CMake] execute a script before and after configuration
On Friday, January 20, 2012, Michael Hertling mhertl...@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? -- 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