On Fri, May 22, 2009 at 11:46 PM, Steve Huston <[email protected]> wrote:
> Hi John,
>
> Thanks for replying.
>
>> On Fri, May 22, 2009 at 12:18 PM, Steve Huston
>> <[email protected]> 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.

Why not to use something like this:

if(MSVC_IDE)
  set(out_dir "$(OutDir)") # expanded by Visual Studio
else(MSVC_IDE)
  set(out_dir ${PROJECT_BINARY_DIR})
endif(MSVC_IDE)

Nmake generator (instead of Visual Studio one) could be another option.

- Dmitry Bely
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to