CMake/Tests/ExternalProject/TryCheckout.cmake
Kitware Robot 9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00

55 lines
1.4 KiB
CMake

find_package(CVS)
find_package(Subversion)
function(try_cvs_checkout repository module dir result_var)
# Assume cvs checkouts will not work:
set(${result_var} 0 PARENT_SCOPE)
if(CVS_EXECUTABLE)
message(STATUS "try_cvs_checkout")
# Ensure directory exists so we can call cvs in it:
file(MAKE_DIRECTORY "${dir}")
# Try to do the cvs checkout command:
execute_process(COMMAND ${CVS_EXECUTABLE} -d ${repository} co ${module}
WORKING_DIRECTORY ${dir}
TIMEOUT 30
RESULT_VARIABLE rv)
# If it worked, cvs checkouts will work:
if(rv EQUAL 0)
set(${result_var} 1 PARENT_SCOPE)
endif()
message(STATUS "try_cvs_checkout -- done")
endif()
endfunction()
function(try_svn_checkout repository dir result_var)
# Assume svn checkouts will not work:
set(${result_var} 0 PARENT_SCOPE)
if(Subversion_SVN_EXECUTABLE)
message(STATUS "try_svn_checkout")
# Ensure directory exists so we can call svn in it:
file(MAKE_DIRECTORY "${dir}")
# Try to do the svn checkout command:
execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} co ${repository} ${dir}
WORKING_DIRECTORY ${dir}
TIMEOUT 30
RESULT_VARIABLE rv)
# If it worked, svn checkouts will work:
if(rv EQUAL 0)
set(${result_var} 1 PARENT_SCOPE)
endif()
message(STATUS "try_svn_checkout -- done")
endif()
endfunction()