[cmake-developers] execute_process inconsitancy

J Decker d3ck0r at gmail.com
Tue Sep 4 02:19:32 EDT 2012


On Mon, Sep 3, 2012 at 7:50 PM, David Cole <david.cole at kitware.com> wrote:
> That's not a workaround, that's the solution. The quotes don't belong there.
>

I dunno seems to be an application specific failure....

>
>
> On Sep 3, 2012, at 10:24 PM, J Decker <d3ck0r at gmail.com> wrote:
>
>> I do have a workaround by taking the quotes out of the path...
>>
>> On Mon, Sep 3, 2012 at 7:23 PM, J Decker <d3ck0r at gmail.com> wrote:
>>> On Mon, Sep 3, 2012 at 3:58 PM, David Cole <david.cole at kitware.com> wrote:
>>>> OK... Is hg.exe in the PATH? Do you get different results if you use
>>>> the full path to hg.exe rather than just "hg"?
>>>>
>>> hg is in the path; although, when hg is not in the path, the result is the same.
>>>
>>> hg.exe is the same result
>>>
>>>
>>> PATH=C:\Windows;C:\Windows\system32;c:\develop\tools;c:\ftn3000\bin;c:\ftn3000\utility;;c:\Develop\tools\startups\..\..\tools\unix;c:\Develo
>>> p\tools\startups\..\..\tools\nasm;c:\Develop\tools\startups\..\..\tools\watcom\binnt;c:\Develop\tools\startups\..\..\tools\watcom\binw;c:\De
>>> velop\tools\startups\..\..\tools\unix\cmake\bin;"C:\Program Files\TortoiseHg\"
>>>
>>> the following is the search...
>>> C:\Develop\tools\unix\cmake\bin\hg.exe
>>> cmake_source_dir
>>> 32bit c:\windows\syswow64
>>> c:\windows\system.hg.exe
>>> c:\windows\hg.exe
>>> 32bit c:\windows\syswow64
>>> c:\develop\tools
>>> c:\ftn3000\bin
>>> c:\ftn3000...... (path up to)
>>>
>>> c:\develop\tools\unix\cmake\bin\hg.exe
>>>
>>> then (and I think this is where it's wrong, I don't know how it would
>>> have created this path)
>>>
>>> M:\sack\"c:\program files\tortoisehg\"\hg.exe
>>>
>>>
>>> then it does the same search but looking for 'hg.exe id' instead of
>>> just 'hg.exe'
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> On Mon, Sep 3, 2012 at 5:48 PM, J Decker <d3ck0r at gmail.com> wrote:
>>>>> dir "c:\Program Files\tortoisehg
>>>>> Volume in drive C has no label.
>>>>> Volume Serial Number is F05B-C5AF
>>>>>
>>>>> Directory of c:\Program Files\tortoisehg
>>>>> ....
>>>>> 08/20/2012  10:47 PM            33,544 hg.exe
>>>>> ....
>>>>>
>>>>> I don't know what hy.py would be .....
>>>>>
>>>>> On Mon, Sep 3, 2012 at 2:37 PM, David Cole <david.cole at kitware.com> wrote:
>>>>>> On Mon, Sep 3, 2012 at 5:15 PM, J Decker <d3ck0r at gmail.com> wrote:
>>>>>>> On Mon, Sep 3, 2012 at 1:04 PM, Brad King <brad.king at kitware.com> wrote:
>>>>>>>> On 09/03/2012 03:04 PM, J Decker wrote:
>>>>>>>>> I use this command to get the current repository version number.
>>>>>>>>>
>>>>>>>>> Under windows I have to use 'cmd /c ...'
>>>>>>>>> under linux or I obviously can't use that.
>>>>>>>>>
>>>>>>>>> Is there a test I can do in a cmakelists to test the shell processor?
>>>>>>>>>
>>>>>>>>> Is there something I can do to make this the same command?
>>>>>>>>>
>>>>>>>>> Under windows, without cmd /c .... the output variable is blank.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> if( WIN32 )
>>>>>>>>>
>>>>>>>>> execute_process( COMMAND cmd /c hg id -i WORKING_DIRECTORY
>>>>>>>>> ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE TMP_CURRENT_REPO_REVISION )
>>>>>>>>>
>>>>>>>>> else( WIN32 )
>>>>>>>>>
>>>>>>>>> execute_process( COMMAND hg id -i WORKING_DIRECTORY
>>>>>>>>> ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE TMP_CURRENT_REPO_REVISION )
>>>>>>>>>
>>>>>>>
>>>>>>> execute_process( COMMAND hg id -i WORKING_DIRECTORY
>>>>>>> ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE TMP_CURRENT_REPO_REVISION
>>>>>>> ERROR_VARIABLE TMP_CURRENT_REPO_REVISION2 )
>>>>>>> message( "1)" ${TMP_CURRENT_REPO_REVISION} )
>>>>>>> message( "1)" ${TMP_CURRENT_REPO_REVISION2} )
>>>>>>>
>>>>>>> both revision and revision2 are blank, (without cmd /c before)
>>>>>>>
>>>>>>>>> endif( WIN32 )
>>>>>>>>
>>>>>>>> The command operates the same way on both platforms.
>>>>>>>> My guess is that "hg" is printing to stderr on Windows.
>>>>>>>> Try this:
>>>>>>>>
>>>>>>>> execute_process(
>>>>>>>>   COMMAND hg id -i
>>>>>>>>   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
>>>>>>>>   OUTPUT_VARIABLE TMP_CURRENT_REPO_REVISION
>>>>>>>>   ERROR_VARIABLE TMP_CURRENT_REPO_REVISION
>>>>>>>>   )
>>>>>>>>
>>>>>>>> -Brad
>>>>>>> --
>>>>>>>
>>>>>>> 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>>>>>>
>>>>>>
>>>>>> On Windows, "hg" is not an executable file, so execute_process is
>>>>>> probably not even running it. If you instead say:
>>>>>>
>>>>>>  COMMAND C:/python26/python.exe C:/path/to/hg.py (... args ...)
>>>>>>
>>>>>> does that work?



More information about the cmake-developers mailing list