Allow make-version.pl to use git when missing from path
[metze/wireshark/wip.git] / CMakeLists.txt
index 5390ba84eeae6504a772e490ed74df6a2f6f2b1a..50d645d18358aac38fe1d749d1e7ad23d780c0ba 100644 (file)
@@ -595,25 +595,22 @@ else()
        set (C_UNUSED "" )
 endif()
 
-
-if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
-       set(WIRESHARK_LD_FLAGS
-               -Wl,--as-needed
-               # -flto
-               # -fwhopr
-               # -fwhole-program
+set(WIRESHARK_LD_FLAGS
+       -Wl,--as-needed
+       # -flto
+       # -fwhopr
+       # -fwhole-program
+)
+# CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
+# 2.8.9. Do not add -pie automatically for older versions.
+#
+# XXX - are there other compilers that don't support -pie?  It's
+# not as if the only platforms we support are Windows and Linux....
+#
+if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
+       set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
+               -pie
        )
-       # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
-       # 2.8.9. Do not add -pie automatically for older versions.
-       #
-       # XXX - are there other compilers that don't support -pie?  It's
-       # not as if the only platforms we support are Windows and Linux....
-       #
-       if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
-               set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
-                       -pie
-               )
-       endif()
 endif()
 
 include(CheckCLinkerFlag)
@@ -645,7 +642,7 @@ endif()
 # - set HAVE_XXX
 
 #The minimum package list
-set(PACKAGELIST Gettext M GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
+set(PACKAGELIST Gettext M Git GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
 set(LEX_REQUIRED TRUE)
 set(GLIB2_REQUIRED TRUE)
 set(GLIB2_FIND_REQUIRED TRUE)
@@ -1145,11 +1142,14 @@ else()
        set(WS_MSVC_NORETURN " ")
 endif()
 
+if (${GIT_EXECUTABLE})
+       set(GIT_BIN_PARAM "--git-bin ${GIT_EXECUTABLE}")
+endif()
 set( VERSION ${PROJECT_VERSION} )
 execute_process(
        COMMAND ${PERL_EXECUTABLE}
                ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
-               --print-vcs
+               --print-vcs ${GIT_BIN_PARAM}
                ${CMAKE_CURRENT_SOURCE_DIR}
        OUTPUT_VARIABLE VERSION_H_CONTENT
 )