From 343cbf9236475386f9967c3383a5282787f2517a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Thu, 9 Apr 2020 16:09:59 -0400 Subject: [PATCH] ENH: add the .exe executable extension to clang-format on Windows --- CMake/ITKClangFormatSetup.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMake/ITKClangFormatSetup.cmake b/CMake/ITKClangFormatSetup.cmake index abffdd57379..793bb7fbf71 100644 --- a/CMake/ITKClangFormatSetup.cmake +++ b/CMake/ITKClangFormatSetup.cmake @@ -41,12 +41,16 @@ if ( ITK_USE_CLANGFORMAT AND NOT EXISTS "${CLANGFORMAT_EXECUTABLE}" ) message(FATAL_ERROR "UNKOWN SYSTEM: Set CLANGFORMAT_EXECUTABLE manually to the clang-format version 8.0 binary") endif() file(MAKE_DIRECTORY "${ITK_BINARY_DIR}/temp") - file(DOWNLOAD "${CLANGFORMAT_DOWNLOAD_URL}" "${ITK_BINARY_DIR}/temp/clang-format-${CMAKE_SYSTEM_NAME}") - file(COPY "${ITK_BINARY_DIR}/temp/clang-format-${CMAKE_SYSTEM_NAME}" + if(WIN32) + set(exe .exe) + endif() + set(CLANGFORMAT_EXECUTABLE_NAME "clang-format-${CMAKE_SYSTEM_NAME}${exe}") + file(DOWNLOAD "${CLANGFORMAT_DOWNLOAD_URL}" "${ITK_BINARY_DIR}/temp/${CLANGFORMAT_EXECUTABLE_NAME}") + file(COPY "${ITK_BINARY_DIR}/temp/${CLANGFORMAT_EXECUTABLE_NAME}" DESTINATION "${ITK_BINARY_DIR}" FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) unset( CLANGFORMAT_DOWNLOAD_URL ) - set( CLANGFORMAT_EXECUTABLE "${ITK_BINARY_DIR}/clang-format-${CMAKE_SYSTEM_NAME}" CACHE FILEPATH "The binary for clang-format" FORCE) + set( CLANGFORMAT_EXECUTABLE "${ITK_BINARY_DIR}/${CLANGFORMAT_EXECUTABLE_NAME}" CACHE FILEPATH "The binary for clang-format" FORCE) endif() if(CLANGFORMAT_EXECUTABLE) mark_as_advanced(CLANGFORMAT_EXECUTABLE)