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?