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

Steve Huston shuston at riverace.com
Fri May 22 15:46:01 EDT 2009


Hi John,

Thanks for replying.

> On Fri, May 22, 2009 at 12:18 PM, Steve Huston 
> <shuston at riverace.com> wrote:
> > 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?
> 
> Shouldn't you already know the path in your CMakeLists.txt?
> 
> It should be somewhere off of
> ${PROJECT_BINARY_DIR}

"somewhere off of" is the operative phrase... Exactly where is what I
need to know. For example, in a Windows Debug build, it's in
${PROJECT_BINARY_DIR}\Debug.

-Steve



More information about the CMake mailing list