[CMake] how to define current working directory of command line tool

Ryan Pavlik rpavlik at iastate.edu
Fri Oct 29 13:02:12 EDT 2010


On Fri, Oct 29, 2010 at 7:48 AM, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:
>
>>>>>
>>>>>
>>>>
>>>> Are you trying to run the executable with ADD_TEST? In that case the
>>>> working directory is always CMAKE_CURRENT_BINARY_DIR. If you need to change
>>>> it, create a wrapper script (you can do so using the CMake language in order
>>>> to not depend on any other interpreter).
>>>>
>>>>
>>>
>>> no, just add_executable and then starting the target in debug mode inside
>>> the ide. but maybe add_test is the solution to my
>>> problem, i have to look at it. is this for starting an executable with
>>> some command line arguments?
>>>
>>> -Jochen
>>>
>>>
>>
>> It is for adding a single unit test which can then be run using CTest.
>>
>> Michael
>
> Perhaps adding unit tests for testing my command line tool is the right way,
> but really practical would be to
> have a target property to set the default debugging working directory for a
> target.
> In visual studio this is right click on a target, then properties. Then on
> the left side Configuration Properties->Debugging
> and on the right side Working Directory. This is used when you launch the
> target from inside the IDE. I always have
> to set it by hand. Even worse on macos: there I have to set it every time
> cmake has run.
> Therefore I still would request this feature (e.g.
> set_target_properties(MyTarget PROPERTIES WORKING_DIRECTORY
> ${CMAKE_CURRENT_SOURCE_DIR}) )
>
> -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
>


See my "CreateLaunchers.cmake" script here:
http://github.com/rpavlik/cmake-modules

-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik


More information about the CMake mailing list