I have this code in my CMake file to get SVN version info and push it into a define that my project can use:
find_package(Subversion)
if(SUBVERSION_FOUND)
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} MyProj)
target_compile_definitions(MyProj PUBLIC "-DSVN_RC=${MyProj_WC_REVISION}" )
endif(SUBVERSION_FOUND)
This uses a macro found in the default CMake distribution. This is effectively what the macro does:
macro(Subversion_WC_INFO dir prefix)
execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
RESULT_VARIABLE Subversion_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${Subversion_svn_info_result} EQUAL 0)
message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
endif()
endmacro()
My problem is that this code fails. The output of my configuration looks like this:
CMake Error at C:/msys64/mingw32/share/cmake-3.8/Modules/FindSubversion.cmake:99 (message):
Command "C:/msys64/usr/bin/svn.exe info
C:/msys64/home/stew/proj"
failed with output:
svn: warning: W155010: The node '/home/stew/proj/build/C:/msys64/home/stew/proj/' was not found.
svn: E200009: Could not display info for all targets because some targets don't exist
I think the problem is my msys environment which is kind of a fake-root environment. svn info /home/stew/proj works while svn info c:/msys64/home/stew/proj doesn't work. ${CMAKE_CURRENT_SOURCE_DIR} gives me the windows path which is a problem for svn. Is there a way to translate the `${CMAKE_CURRENT_SOURCE_DIR} output in Windows format into the fakeroot format? If not, is there a way to force SVN to accept the other path?