[CMake] Running tests using [C++/Python] modules from the build tree
Pere Mato Vila
Pere.Mato at cern.ch
Tue Sep 28 12:42:25 EDT 2010
Hi,
I am seeking for advise. I would like to run some CTest tests from the build tree, which require C++ or Python modules created in other project directories (packages). For this I need to build correctly the LD_LIBRARY_PATH and PYTHONPATH and use the command set_property(TEST xxx PROPERTY ENVIRONMENT LD_LIBRARY_PATH=yyy PYTHONPATH=xxx). The question is how to make this the most easy and transparent way as possible, since the modules I would need in the tests are not easily known a priori.
If I could set a global variable in each package that creates a module, something like <PACKAGE>_MODULE_DIRS and I could collect these in the package that I want to run the test and build the ENVIRONMENT property accordingly. The problem is that it is not so easy in CMake to set global variables.
Another alternative would be to define a function called module_directories(), which behaves like the command link_dicrectories(), that I could call every time I create/define a module. I would then recover the list of directories using a specific directory property, as it is done in the case of LINK_DIRECTORIES.
Does anybody has a similar problem and has found an elegant solution? Many thanks in advance.
-------------------------------------------------------------
Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland
e-mail: pere.mato at cern.ch tel: +41 22 76 78696
fax: +41 22 76 68792 gsm: +41 76 48 70855
More information about the CMake
mailing list