Author: Pino Toscano <pino@debian.org>
Description: Select which executable to use as "clang++"
 This way, we can set a specific one, in case the distribution ships different
 versions of LLVM/Clang.
Forwarded: no
Last-Update: 2019-02-01

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,10 @@ if(NOT CLAZY_BUILD_WITH_CLANG AND MSVC A
   message(FATAL_ERROR "\nOn MSVC you need to pass -DCLANG_LIBRARY_IMPORT=C:/path/to/llvm-build/lib/clang.lib to cmake when building Clazy.\nAlso make sure you've built LLVM with -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
 endif()
 
+if(NOT CLANGPP_EXECUTABLE)
+  set(CLANGPP_EXECUTABLE "clang++")
+endif()
+
 if(MSVC)
   # disable trigger-happy warnings from Clang/LLVM headers
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244 /wd4291 /wd4800 /wd4141 /wd4146 /wd4251")
--- a/clazy.cmake
+++ b/clazy.cmake
@@ -34,7 +34,7 @@ HELP() {
 
 VERSION() {
     echo "clazy version: @CLAZY_PRINT_VERSION@"
-    ${CLANGXX:-clang++} --version | head -1 | awk '{printf("clang version: %s\n",$3)}'
+    ${CLANGXX:-@CLANGPP_EXECUTABLE@} --version | head -1 | awk '{printf("clang version: %s\n",$3)}'
 }
 
 PRLIST() {
@@ -147,5 +147,5 @@ then
     $(dirname $0)/bin/clazy-standalone "$@"
   fi
 else
-  ${CLANGXX:-clang++} -Qunused-arguments -Xclang -load -Xclang $ClazyPluginLib -Xclang -add-plugin -Xclang clazy $ExtraClangOptions "$@"
+  ${CLANGXX:-@CLANGPP_EXECUTABLE@} -Qunused-arguments -Xclang -load -Xclang $ClazyPluginLib -Xclang -add-plugin -Xclang clazy $ExtraClangOptions "$@"
 fi
