Add make format target to run clang-format

This commit is contained in:
Jesse Beder
2014-03-24 23:46:03 -05:00
parent d59586630e
commit dc8d91ce45

View File

@@ -153,7 +153,7 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${yaml_cxx_flags}")
### Make specific
if(${CMAKE_BUILD_TOOL} STREQUAL make OR ${CMAKE_BUILD_TOOL} STREQUAL gmake)
if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake)
add_custom_target(debuggable $(MAKE) clean
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
COMMENT "Adjusting settings for debug compilation"
@@ -162,6 +162,10 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
COMMENT "Adjusting settings for release compilation"
VERBATIM)
add_custom_target(format
COMMAND clang-format --style=file -i ${all_sources}
COMMENT "Running clang-format"
VERBATIM)
endif()
endif()