iwyu: support external find (#32458)

This commit is contained in:
Seth R. Johnson 2022-09-12 10:22:14 -04:00 committed by GitHub
parent bb6c39ea7c
commit d4065e11c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
import archspec
from spack.package import *
@ -18,6 +20,10 @@ class Iwyu(CMakePackage):
maintainers = ["sethrj"]
tags = ["build-tools"]
executables = ["^include-what-you-use$"]
version("0.18", sha256="9102fc8419294757df86a89ce6ec305f8d90a818d1f2598a139d15eb1894b8f3")
version("0.17", sha256="eca7c04f8b416b6385ed00e33669a7fa4693cd26cb72b522cde558828eb0c665")
version("0.16", sha256="8d6fc9b255343bc1e5ec459e39512df1d51c60e03562985e0076036119ff5a1c")
@ -43,6 +49,12 @@ class Iwyu(CMakePackage):
for _arch in _arches - set(["x86", "x86_64"]):
depends_on("llvm targets=x86", when="arch={0}:".format(_arch))
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str, error=str)
match = re.search(r"include-what-you-use\s+(\S+)", output)
return match.group(1) if match else None
@when("@0.14:")
def cmake_args(self):
return [self.define("CMAKE_CXX_STANDARD", 14), self.define("CMAKE_CXX_EXTENSIONS", False)]