[CMake] visual studio 10: how to set working directory for RUN_TESTS

David Cole david.cole at kitware.com
Thu Mar 8 15:23:41 EST 2012


On Thu, Mar 8, 2012 at 2:59 PM, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:
> Hi!
>
> for visual studio 10 I have enable_testing() and some test modules. the
> problem is that the working directory is wrong.
> I have set it using the WORKING_DIRECTORY option for add_test
> (set to ${CMAKE_CURRENT_SOURCE_DIR}),
> also in LastTest.log.tmp there is a line
> "WORKING_DIRECTORY"
> showing the correct working directory, but the actual working directory
> is not the one that I have set.
> Does anybody have an idea how to get this working?
>
> -Jochen
>
> --
>
> 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

"cmake --help-command add_test" shows two "signatures", one with NAME
and COMMAND keywords, one (the older one) without.

Which signature are you using?

WORKING_DIRECTORY is only available for the NAME+COMMAND signature.
But... if you're using that, it should work. If it doesn't work,
please give us steps to reproduce the problem, and we'll take a look.


HTH,
David


$ cmake --help-command add_test
cmake version 2.8.7
  add_test
       Add a test to the project with the specified arguments.

         add_test(testname Exename arg1 arg2 ... )
...
         add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]
                  [WORKING_DIRECTORY dir]
                  COMMAND <command> [arg1 [arg2 ...]])
...


More information about the CMake mailing list