Skip to content

Commit 77f1dca

Browse files
committed
detect-compiler: detect clang even if it found CUDA
In my setup, clang finds `/usr/local/cuda` and hence the output of `clang -v` ends with this line: Found CUDA installation: /usr/local/cuda, version This confuses the `detect-compiler` script because it matches _all_ lines that contain the needle "version" surrounded by spaces. As a consequence, the `get_family` function returns two lines: "Ubuntu clang" and above-mentioned line, which the `case` statement does not handle well and hence reports "unknown compiler family" instead of the expected set of "clang14", "clang13", ..., "clang1" output. Let's unconfuse the script by letting it parse the first matching line and ignore the rest. Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6b6cd55 commit 77f1dca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

detect-compiler

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CC="$*"
99
#
1010
# FreeBSD clang version 3.4.1 (tags/RELEASE...)
1111
get_version_line() {
12-
LANG=C LC_ALL=C $CC -v 2>&1 | grep ' version '
12+
LANG=C LC_ALL=C $CC -v 2>&1 | sed -n '/ version /{p;q;}'
1313
}
1414

1515
get_family() {

0 commit comments

Comments
 (0)