# The module defines the following variables: # HG_EXECUTABLE - path to mercurial command line client # HG_VERSION_STRING - set to the version of found hg executable # Example usage: # include(FindMercurial) # if(HG_FOUND) # message("Mercurial found: ${HG_EXECUTABLE}" ) # endif() #============================================================================= # Copyright 2012 Minze Zwerver / van Ovost Automatisering BV # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Look for 'hg' maybe more ? set(hg_names hg) find_program(HG_EXECUTABLE NAMES ${hg_names} DOC "Mercurial command line client" ) mark_as_advanced(HG_EXECUTABLE) # Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Mercurial DEFAULT_MSG HG_EXECUTABLE) if(HG_EXECUTABLE) execute_process( COMMAND "${HG_EXECUTABLE}" --version OUTPUT_VARIABLE HG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "^Mercurial Distributed SCM [(]version ([.01234567890]+)[)].*" "\\1" HG_VERSION_STRING "${HG_VERSION}") SET(HG_VERSION_STRING ${HG_VERSION_STRING} CACHE STRING "Mercurial version found." ) mark_as_advanced(HG_VERSION_STRING) endif(HG_EXECUTABLE)