Build: On Windows, ensure we have found Cygwin bash

git can be installed (or the path manually set) so that the msys
unix utilities supplied with git (expecially bash) are on the path
and then picked up by CMake.  These utilities are not compatible with
the build and will fail.

This change checks the output of the --version option to the found
executable and ensures "cygwin" is found in the result.  If not found
a FATAL_ERROR message is issued and the CMake generation is stopped.

Change-Id: I0eca014ae194862abbc8dee56d347526691e72cb
Reviewed-on: https://code.wireshark.org/review/13008
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
This commit is contained in:
Graham Bloice 2016-01-02 21:41:00 +00:00
parent 3866df04dd
commit 40a21c0236
1 changed files with 8 additions and 2 deletions

View File

@ -19,9 +19,15 @@ find_program( SH_EXECUTABLE
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( SH DEFAULT_MSG SH_EXECUTABLE )
# FIXME: Don't match on the name but check whether the argument is
# accepted or not. OTOH, if it isn't accepted, build will fail on Win.
# Ensure this is Cygwin bash
if( WIN32 )
execute_process( COMMAND ${SH_EXECUTABLE} --version OUTPUT_VARIABLE SH_VERSION )
string( FIND "${SH_VERSION}" "cygwin" SH_IS_CYGWIN )
if( ${SH_IS_CYGWIN} LESS 0 )
set( BAD_SH ${SH_EXECUTABLE} )
unset( SH_EXECUTABLE CACHE )
message( FATAL_ERROR "The bash executable (${BAD_SH}) isn't from Cygwin. Check your path" )
endif()
set( SH_FLAGS1 -o )
set( SH_FLAGS2 igncr )
endif()