blob: 0a50a6a8c42694caeab6458423072521566fbe89 [file] [log] [blame]
Stephen Hines651f13c2014-04-23 16:59:28 -07001option(BUILD_CLANG_FORMAT_VS_PLUGIN "Build clang-format VS plugin" OFF)
2if (BUILD_CLANG_FORMAT_VS_PLUGIN)
3 add_custom_target(clang_format_exe_for_vsix
4 ${CMAKE_COMMAND} -E copy_if_different
5 "${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}/clang-format.exe"
6 "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/clang-format.exe"
7 DEPENDS clang-format)
8
Stephen Hines176edba2014-12-01 14:53:08 -08009 add_custom_target(clang_format_license
10 ${CMAKE_COMMAND} -E copy_if_different
11 "${CLANG_SOURCE_DIR}/LICENSE.TXT"
12 "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/license.txt")
13
14 if (NOT CLANG_FORMAT_VS_VERSION)
15 set(CLANG_FORMAT_VS_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
16 endif()
17
18 configure_file("source.extension.vsixmanifest.in"
19 "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest")
20
Stephen Hines651f13c2014-04-23 16:59:28 -070021 add_custom_target(clang_format_vsix ALL
22 devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release
Stephen Hines176edba2014-12-01 14:53:08 -080023 DEPENDS clang_format_exe_for_vsix "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest"
Stephen Hines651f13c2014-04-23 16:59:28 -070024 COMMAND ${CMAKE_COMMAND} -E copy_if_different
25 "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/bin/Release/ClangFormat.vsix"
26 "${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ClangFormat.vsix"
Stephen Hines176edba2014-12-01 14:53:08 -080027 DEPENDS clang_format_exe_for_vsix clang_format_license)
Stephen Hines651f13c2014-04-23 16:59:28 -070028endif()