Yes. The net effect from svn's point of view is that one of the
arguments given to it contains a space.

On Wed, Jul 13, 2011 at 11:31 PM,  <[email protected]> wrote:
> Ah, so does that mean that it is escaping the space, similar to --username\ 
> MyUserName ?
>
> Aaron Meadows
>
>
> -----Original Message-----
> From: David Cole [mailto:[email protected]]
> Sent: Wednesday, July 13, 2011 4:09 PM
> To: Meadows, Aaron C.
> Cc: [email protected]
> Subject: Re: [CMake] Issues with execute_process and svn
>
> It boils down to this:
>
> set(args --username MyUserName)
> # sets args to a list with two elements
>
> set(args "--username MyUserName")
> # sets args to a list with one element: a string containing a space
>
> execute_process(COMMAND blah ${args})
> # calls the command "blah" expanding the n-element CMake list variable
> "args" such that each list element is a separate arg to
> execute_process, and hence a separate arg to the blah command
>
>
> HTH,
> David
>
>
> On Wed, Jul 13, 2011 at 4:20 PM,  <[email protected]> wrote:
>> That works!  Thanks!
>>
>> Any idea why the other way was causing issues?
>>
>> Aaron Meadows
>>
>>
>> -----Original Message-----
>> From: David Cole [mailto:[email protected]]
>> Sent: Wednesday, July 13, 2011 1:06 PM
>> To: Meadows, Aaron C.
>> Cc: [email protected]
>> Subject: Re: [CMake] Issues with execute_process and svn
>>
>> Take the double quotes off the set commands for your args variables.
>> And put spaces in between the dereferences of those vars in the
>> execute_process command.
>>
>> Like this:
>>
>> # No double quotes here:
>> if(NOT $ENV{CMAKE_SVN_USERNAME} STREQUAL "")
>>  set(_SvnCredPart --no-auth-cache)
>>  set(_SvnUserPart --username $ENV{CMAKE_SVN_USERNAME})
>> endif()
>> if(NOT $ENV{CMAKE_SVN_PASSWORD} STREQUAL "")
>>  set(_SvnCredPart --no-auth-cache)
>>  set(_SvnPassPart --password $ENV{CMAKE_SVN_PASSWORD})
>> endif()
>>
>> # Spaces in between dereferenced vars here:
>> execute_process(COMMAND "${svnexe}" --non-interactive
>>  ${_SvnCredPart} ${_SvnUserPart} ${_SvnPassPart}
>>  info .
>>  OUTPUT_VARIABLE _out
>>  ERROR_VARIABLE _err
>>  RESULT_VARIABLE _res)
>>
>> message(STATUS "out: ${_out}")
>> message(STATUS "err: ${_err}")
>> message(STATUS "res: ${_res}")
>>
>>
>> HTH,
>> David
>>
>>
>> On Wed, Jul 13, 2011 at 1:57 PM,  <[email protected]> wrote:
>>> Hi all,
>>>
>>>
>>>
>>> I've been having a devil of a time with executing SVN with execute_process.
>>> Basically, I need to read environment variables to specify the username and
>>> password for builds on our build server (where we do not cache credentials).
>>>
>>>
>>>
>>> I've made several attempts at this, and have been foiled continually by one
>>> problem, exemplified in the attached CMakeLists.txt.  If I build arguments
>>> in variables and then specify them in the execute_process, I get an error
>>> like this:
>>>
>>>
>>>
>>> -- err: svn.exe: invalid option: --no-auth-cache --username foo --password
>>> bar
>>>
>>> Type 'svn help' for usage.
>>>
>>>
>>>
>>> However, if I write the identical command to a file and execute that, I get
>>> no issue.  I've narrowed it down to the <space> between --username and foo,
>>> but can't seem to figure out what the deal is.  I've tried replacing them
>>> with a value from string(ASCI 32 _sep), but that didn't change the
>>> behavior.  I've tried this on Windows 7 and Windows Server 2008, and both
>>> behave the same way.
>>>
>>>
>>>
>>> You can try these two methods out on the CMakeLists.txt.  By default, it
>>> will use the straight execute_process.  If you call cmake with -D TestFile=1
>>> it will write the commands to a file and execute that.  (in which case
>>> you'll get svn: '.' is not a working copy and not the invalid option issue)
>>>
>>>
>>>
>>> Thanks for any help you can provide!
>>>
>>>
>>>
>>> Aaron Meadows
>>> Software Engineer
>>>
>>> Thomson Reuters
>>>
>>> Phone: 314.468.3530
>>> Mobile: 636.541.6139
>>> [email protected]
>>> thomsonreuters.com
>>>
>>>
>>>
>>> This email was sent to you by Thomson Reuters, the global news and
>>> information company. Any views expressed in this message are those of the
>>> individual sender, except where the sender specifically states them to be
>>> the views of Thomson Reuters.
>>> _______________________________________________
>>> 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
>>>
>>
>> This email was sent to you by Thomson Reuters, the global news and 
>> information company. Any views expressed in this message are those of the 
>> individual sender, except where the sender specifically states them to be 
>> the views of Thomson Reuters.
>>
>
> This email was sent to you by Thomson Reuters, the global news and 
> information company. Any views expressed in this message are those of the 
> individual sender, except where the sender specifically states them to be the 
> views of Thomson Reuters.
>
_______________________________________________
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