On Tue, 2010-09-28 at 18:42 +0200, Pere Mato Vila wrote:
> 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.
> 
> 
Hi Pere,

You could write a wrapper script that sets your environment variables.
Since you don't know the actual values for these variables beforehand,
you should let CMake generate this script, using configure_file().
That's the way I do it, and it works great.

Best regards,
Marcel Loose.

_______________________________________________
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