2009-09-23 19:40:25 +00:00
|
|
|
#
|
2009-09-08 07:03:57 +00:00
|
|
|
# - Find unix commands from cygwin
|
|
|
|
# This module looks for some usual Unix commands.
|
|
|
|
#
|
|
|
|
|
2013-10-04 23:23:16 +00:00
|
|
|
include( FindCygwin )
|
2009-09-08 07:03:57 +00:00
|
|
|
|
2013-10-04 23:23:16 +00:00
|
|
|
find_program( SH_EXECUTABLE
|
2009-09-08 07:03:57 +00:00
|
|
|
NAMES
|
2013-10-04 23:23:16 +00:00
|
|
|
bash
|
2009-09-08 07:03:57 +00:00
|
|
|
PATHS
|
|
|
|
${CYGWIN_INSTALL_PATH}/bin
|
|
|
|
/bin
|
|
|
|
/usr/bin
|
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2013-10-04 23:23:16 +00:00
|
|
|
include( FindPackageHandleStandardArgs )
|
|
|
|
find_package_handle_standard_args( SH DEFAULT_MSG SH_EXECUTABLE )
|
2009-09-08 07:03:57 +00:00
|
|
|
|
2016-01-02 21:41:00 +00:00
|
|
|
# Ensure this is Cygwin bash
|
2017-04-24 16:14:29 +00:00
|
|
|
if( WIN32 AND CYGWIN_INSTALL_PATH )
|
2016-01-02 21:41:00 +00:00
|
|
|
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()
|
2013-10-04 23:23:16 +00:00
|
|
|
set( SH_FLAGS1 -o )
|
|
|
|
set( SH_FLAGS2 igncr )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
mark_as_advanced( SH_EXECUTABLE )
|
2009-09-08 07:03:57 +00:00
|
|
|
|