MantisBT - CMake
View Issue Details
0015864CMake(No Category)public2015-11-26 11:462016-05-02 08:30
Arthur Klassen 
David Cole 
normalminorsometimes
closedno change required 
x86_64Windows7
CMake 3.1.3 
 
0015864: CMake can't always find git.exe in PATH element with quotation marks
My 581-character path includes things in c:\Program Files, some but not all in quotation marks. The element of the USER variable of PATH pointing to git.exe had quotation marks around it and sometimes that prevented cmake from finding it. Removing the quotation marks solved the problem. Their presence does not invalidate the path as far as cmd.exe is concerned: it found git.exe just fine either way, so this is an issue, if a minor one, easily worked around.

For a "simple" CMakeLists.txt file this problem never occurred!!?
When my PATH variable contained:

set PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Common Files\ThinPrint\;C:\Program Files\TortoiseGit\bin;e:\me\tools;"c:\Program Files\Git\cmd\";%APPDATA%\Python\Scripts;C:\Program Files (x86)\CMake\bin

A three-line CMakeLists.txt file like this:

cmake_minimum_required( VERSION 3.1 )

find_package( Git )

message( "Returned value of GIT_EXECUTABLE is ${GIT_EXECUTABLE}" )

was able to find Git but calling find_package( Git ) from a more complex CMakeLists.txt (that includes other sub-CMakeLists files) failed, even from the first line of the most top-level CMakeLists.txt file, even when the "message()" call was followed by a "return()".

This persisted until I removed the quotation marks from the path. This occurred even if I moved the "git" path to the front of the PATH variable.
No tags attached.
Issue History
2015-11-26 11:46Arthur KlassenNew Issue
2015-11-26 17:43David ColeNote Added: 0039913
2015-11-26 17:45David ColeNote Added: 0039914
2015-11-26 17:45David ColeStatusnew => resolved
2015-11-26 17:45David ColeResolutionopen => no change required
2015-11-26 17:45David ColeAssigned To => David Cole
2015-11-26 18:28Arthur KlassenNote Added: 0039915
2015-11-26 20:41David ColeNote Added: 0039916
2016-05-02 08:30Robert MaynardNote Added: 0040970
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0039913)
David Cole   
2015-11-26 17:43   
This is not a CMake problem. There are practically NO windows programs that could run something via PATH in this scenario inside a directory where there are double quotes in the value of PATH... The problem is the double quotes. They are not necessary, and in fact hinder proper searching, even for the Windows cmd prompt.

I will close this as "not a CMake bug" -- the problem is your PATH setting. Remove the double quotes, and it will work fine.
(0039914)
David Cole   
2015-11-26 17:45   
See previous note
(0039915)
Arthur Klassen   
2015-11-26 18:28   
cmd.exe was happy as a clam either way, so your second sentence is just not true, at least not in the Wonderful Warped World of Windows; but I can live with the status quo. Thanks for taking a look or two at it. cheers...ank
(0039916)
David Cole   
2015-11-26 20:41   
I will concede it's possible it may work somewhere, on some versions of Windows, but I certainly don't think it's true on all versions... I would accept "partially true" as a judgment on my second sentence, but not "untrue."

;-)

Happy Thanksgiving!
(0040970)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.