MantisBT - CMake
View Issue Details
0015791CMakeCCMakepublic2015-10-14 17:262016-03-07 09:12
Mikael Brudfors 
Brad King 
normalminoralways
closedfixed 
PCWindows7 x64
 
CMake 3.4CMake 3.4 
0015791: Error configuring 3D Slicer with CMake 3.4.0-rc1
When configuring 3D Slicer in CMake 3.4.0-rc1 I get the below error, which is not present when using earlier versions of CMake.

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/ExternalProject.cmake:1742 (message):
  error: git version 1.6.5 or later required for 'git submodule update
  --recursive': git_version=''
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/ExternalProject.cmake:2429 (_ep_add_download_command)
  CMake/ExternalProjectAddSource.cmake:77 (ExternalProject_Add)
  CMake/ExternalProjectAddSource.cmake:205 (ExternalProject_Add_Source)
  SuperBuild.cmake:174 (Slicer_Remote_Add)
  CMakeLists.txt:670 (include)
Set source to 3D Slicer source code, press configure.
No tags attached.
Issue History
2015-10-14 17:26Mikael BrudforsNew Issue
2015-10-14 18:22Max SmolensNote Added: 0039605
2015-10-15 08:30Brad KingAssigned To => Brad King
2015-10-15 08:30Brad KingStatusnew => assigned
2015-10-15 08:30Brad KingTarget Version => CMake 3.4
2015-10-15 08:52Brad KingNote Added: 0039609
2015-10-15 09:06Brad KingNote Added: 0039610
2015-10-15 09:10Brad KingNote Added: 0039611
2015-10-15 09:42Brad KingNote Added: 0039612
2015-10-15 09:42Brad KingNote Added: 0039613
2015-10-15 09:42Brad KingStatusassigned => resolved
2015-10-15 09:42Brad KingResolutionopen => fixed
2015-10-15 09:42Brad KingFixed in Version => CMake 3.4
2015-10-15 09:53Mikael BrudforsNote Added: 0039614
2016-03-07 09:12Robert MaynardNote Added: 0040619
2016-03-07 09:12Robert MaynardStatusresolved => closed

Notes
(0039605)
Max Smolens   
2015-10-14 18:22   
It looks like this regressed in the following commit:
https://github.com/Kitware/CMake/commit/b04c38159eb4db35770f541f7671fe33a3f32bc2 [^]
("ExternalProject: Use GIT_VERSION_STRING instead of custom method")

The custom method, _ep_get_git_version in ExternalProject.cmake, parses the version output differently than FindGit.cmake. Now, an error occurs because GIT_VERSION_STRING is never set.

The version output for the latest Git for Windows (https://git-for-windows.github.io/ [^]) is:
$ git --version
git version 2.6.1.windows.1

Note also that the 'message(FATAL_ERROR "error: git version 1.6.5 or later required...' line still uses ${git_version}. That should be updated to use ${GIT_VERSION_STRING}.
(0039609)
Brad King   
2015-10-15 08:52   
Thanks for testing the release candidate and reporting this promptly.

Please try this patch:

diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 2c3e5fd..f1fabf8 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -68,8 +68,8 @@ if(GIT_EXECUTABLE)
                   OUTPUT_VARIABLE git_version
                   ERROR_QUIET
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (git_version MATCHES "^git version [0-9]")
- string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ if (git_version MATCHES "^git version (.+)$")
+ set(GIT_VERSION_STRING "${CMAKE_MATCH_1}")
   endif()
   unset(git_version)
 endif()
(0039610)
Brad King   
2015-10-15 09:06   
Meanwhile here is a fix for the error message:

 ExternalProject: Fix Git version report in error message
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4cd52dc5 [^]
(0039611)
Brad King   
2015-10-15 09:10   
Re 0015791:0039609: Actually the old code parses the "git version 2.6.1.windows.1" just fine too. The problem is that Slicer has its own FindGit that is hiding CMake's and does not set GIT_VERSION_STRING at all. Our ExternalProject module needs to be taught to tolerate this.
(0039612)
Brad King   
2015-10-15 09:42   
This should fix the main issue:

 ExternalProject: Always use CMake builtin FindGit
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9e0173e [^]
(0039613)
Brad King   
2015-10-15 09:42   
I've queued this for merge to 'release' for 3.4.0-rc2.
(0039614)
Mikael Brudfors   
2015-10-15 09:53   
Thank you!
(0040619)
Robert Maynard   
2016-03-07 09:12   
Closing resolved issues that have not been updated in more than 4 months.