CMake and bzr are not playing nice together once again.  CMake can find
the bzr executable but now I'm getting the error "The system cannot find
the file specified" when attempting to run `bzr --version` using CMake's
execute_command() macro.  This is odd because the file and path are
pointing to e:/msys2/usr/bin/bzr.  That looks correct on my system.  I
know at one time this worked correctly but seems to have been broken
recently but I'm not exactly sure when.  For grins and giggles I tried
removing the msys2 version of bzr and installing a native build of bzr
but that failed as well once again with the correct path.  I've attached
a simple CMakeLists.txt file to demonstrate the issue.  I'm using the
command `CMake -G "MSYS2 Makefiles" /path/to/CMakeLists.txt/`.  Any ideas?

Cheers,

Wayne
cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )

find_program( Bazaar_EXECUTABLE bzr
              DOC "Bazaar version control system command line client" )
mark_as_advanced( Bazaar_EXECUTABLE )

if( Bazaar_EXECUTABLE )

    # Bazaar commands should be executed with the C locale, otherwise
    # the message (which are parsed) may be translated causing the regular
    # expressions to fail.
    set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
    set( ENV{LC_ALL} C )

    # Fetch the Bazaar executable version.
    execute_process( COMMAND "${Bazaar_EXECUTABLE} --version"
                     OUTPUT_VARIABLE _bzr_version_output
                     ERROR_VARIABLE _bzr_version_error
                     RESULT_VARIABLE _bzr_version_result
                     OUTPUT_STRIP_TRAILING_WHITESPACE )

    message( STATUS "Output of command ${Bazaar_EXECUTABLE} --version was 
${_bzr_version_result}." )

    if( ${_bzr_version_result} EQUAL 0 )
        set( Bazaar_FOUND TRUE )
        string( REGEX REPLACE "^[\n]*Bazaar \\(bzr\\) ([0-9.a-z]+).*"
                "\\1" Bazaar_VERSION "${_bzr_version_output}" )
        message( STATUS "Bazaar version control system version 
${Bazaar_VERSION} found." )
    endif()

    # restore the previous LC_ALL
    set( ENV{LC_ALL} ${_Bazaar_SAVED_LC_ALL} )
endif()

if( NOT Bazaar_FOUND )
    if( NOT Bazaar_FIND_QUIETLY )
        message( STATUS "Bazaar version control command line client was not 
found." )
    else()
        if( Bazaar_FIND_REQUIRED )
            message( FATAL_ERROR "Bazaar version control command line client 
was not found." )
        endif()
    endif()
endif()
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to