Allow older version of clang-format.
This commit is contained in:
@@ -37,14 +37,23 @@ if(CLANG_FORMAT_EXECUTABLE)
|
||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion)
|
||||
# filter out the actual version
|
||||
string(REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}")
|
||||
# we need at least version 10.0.0 !
|
||||
if (clangFormatVersion VERSION_LESS 10.0.0)
|
||||
message(WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 10 and up to nicely format vulkan.hpp")
|
||||
else()
|
||||
# we need at least version 7.0.0 !
|
||||
if (clangFormatVersion VERSION_LESS 7.0.0)
|
||||
message(WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp")
|
||||
else ()
|
||||
message(STATUS " Found clang-format version <" ${clangFormatVersion} ">.")
|
||||
add_definitions(-DCLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}")
|
||||
if (clangFormatVersion VERSION_LESS 10.0.0)
|
||||
message(STATUS " Using .clang-format version 7." )
|
||||
file(READ ".clang-format_7" clangFormat)
|
||||
else ()
|
||||
message(STATUS " Using .clang-format version 10." )
|
||||
file(READ ".clang-format_10" clangFormat)
|
||||
endif ()
|
||||
file(WRITE ".clang-format" ${clangFormat})
|
||||
endif()
|
||||
else()
|
||||
message(WARNING " Could not find clang-format version 10 and up. Generated vulkan.hpp will not be nicely formatted.")
|
||||
message(WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted.")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
|
||||
Reference in New Issue
Block a user