CTest library path

Hi all,

I have a working build, in which I have several tests as well. On a specific environment I use a build in which several of the linked libraries are in atypical directories. Using the CMAKE_FIND_ROOT_PATH this is no problem for building.

But, now I want to run my tests on that environment as well, which does not work… Where CMake has found the libraries and headers in the right place (verified in the cache file), CTest does not seem to use this info to create the library path.
Apparently CTest does create some part of the path, since libraries build by the project itself are found by the test. However, external libs in an atypical directory are not.

I kinda assumed CTest would rely on the CMake cache for the libraries location. This might potentially even be an issue, since the cache might point to some custom build of a library, whereas CTest uses the library found on the library path, resulting in unexpected behaviour.

What am I doing wrong here?

CTest knows nothing of library locations. All of these things should be put into the libraries themselves (RPATH and similar mechanisms) or be part of the environment in which the entire build and test runs (PATH, LD_LIBRARY_PATH, and friends). Generally the former is preferred, but the latter is pretty much what needs to be done on Windows.