[CMake] RUN_TESTS which use dlls not in the executable directory

Darby J Van Uitert darbyb at sci.utah.edu
Wed Mar 14 20:49:07 EST 2007


Hi,

My tests for my project need to load dlls which are not in the 
executable directory, but in the system path. I'm using Visual Studio 7. 
I can run ctest from the command line but not using the RUN_TEST target 
in Visual Studio. I found the following email from 2005 and was 
wondering how people are dealing with this and if there is a work 
around? Thanks.

   -darby j

>/ 2. Does CTest use the PATH environment variable when launching the executable ? It seems not since my program is not able to load some dlls (not in the executable dir but in the system path) when run from the run_test target, but work when run from the command line ! What's the problem here ?
/
The PATH environment variable is used, but the behavior you are seeing 
is actually due to a Visual Studio "feature".  When VS launches 
processes to build its targets it does so in its own environment.  This 
environment contains a PATH that includes the VS compiler directories 
and such.  It also includes the system PATH that was in place WHEN VS 
WAS INSTALLED.  For some reason it does not update this PATH each time 
it runs.  This is why it works when you run ctest from the command line 
but not from the RUN_TESTS target.


-- 
Darby J Van Uitert
SCI Institute
University of Utah
Email: darbyb at sci.utah.edu
Phone: (301) 528-8469




More information about the CMake mailing list