[CMake] How to get the evaluated path to a target - MSVC

Steve Huston shuston at riverace.com
Fri May 22 12:18:51 EDT 2009


I'm using cmake for some cross-platform Linux/Windows stuff. When
ctest runs my tests, there is often the need to have a wrapper script
run the test - it sets up env variables (sometimes by reading the
content of a file), runs the test, scans log files, runs valgrind,
etc. So, I'm passing the actual test exe name to the script, and the
script runs it at the proper time.

This works fine on Linux. On Windows, however, I'm having a problem
getting the actual path - when I get the LOCATION property, it has
$(OutDir) embedded. Visual Studio can substitute this in if ctest/VS
is directly executing the test. However, if passed to the wrapper
script, the VS OutDir variable is not available. Is there a portable
way to get the test executable's path (either relative or complete) so
I can pass it to the wrapper script?

Thanks,
-Steve



More information about the CMake mailing list