@@ -62,52 +62,66 @@ function(generate_ll_file)
62
62
if (NOT clang)
63
63
# Conan deps are available in in PATH
64
64
foreach (hint "${LLVM_TOOLS_BINARY_DIR} " "${Clang_INCLUDE_DIR} /../bin" "${LLVM_INCLUDE_DIR} /../bin" "/usr/local/llvm-14/bin" )
65
- cmake_path(NORMAL_PATH hint OUTPUT_VARIABLE hint)
65
+ if ("${CMAKE_VERSION} " VERSION_GREATER_EQUAL "3.20" )
66
+ cmake_path(NORMAL_PATH hint OUTPUT_VARIABLE hint)
67
+ endif ()
66
68
list (APPEND binary_hint_paths "${hint} " )
67
69
endforeach ()
68
70
message (STATUS "HINTS to find clang/clang++/opt: ${binary_hint_paths} " )
69
71
70
72
if ("${CMAKE_VERSION} " VERSION_LESS "3.25" ) # VALIDATOR requires it
71
-
73
+ message (WARNING "I would prefer CMake >= 3.25 but I will try my best to resolve deps." )
72
74
find_program (clang REQUIRED
73
75
NAMES clang-14 clang
74
76
HINTS ${binary_hint_paths} )
75
77
find_program (clangcpp REQUIRED
76
- NAMES clang++
78
+ NAMES clang++-14 clang++
77
79
HINTS ${binary_hint_paths} )
78
80
find_program (opt REQUIRED
79
- NAMES opt
81
+ NAMES opt-14 opt
80
82
HINTS ${binary_hint_paths} )
81
83
82
84
set (IS_VALID_VERSION "" )
83
85
validate_binary_version("IS_VALID_VERSION" "${clang} " )
84
86
if (NOT "${IS_VALID_VERSION} " )
85
- message (FATAL_ERROR "Couldn't find clang in version 14 " )
87
+ set ( clang " " )
86
88
endif ()
87
89
validate_binary_version("IS_VALID_VERSION" "${clangcpp} " )
88
90
if (NOT "${IS_VALID_VERSION} " )
89
- message (FATAL_ERROR "Couldn't find clang++ in version 14 " )
91
+ set (clangcpp " " )
90
92
endif ()
91
93
validate_binary_version("IS_VALID_VERSION" "${opt} " )
92
94
if (NOT "${IS_VALID_VERSION} " )
93
- message (FATAL_ERROR "Couldn't find opt in version 14 " )
95
+ set ( opt " " )
94
96
endif ()
95
97
else ()
96
98
find_program (clang REQUIRED
97
99
NAMES clang-14 clang
98
100
HINTS ${binary_hint_paths}
99
101
VALIDATOR validate_binary_version)
100
- message (STATUS "found clang binary in \" ${clang} \" " )
101
102
find_program (clangcpp REQUIRED
102
- NAMES clang++
103
+ NAMES clang++-14 clang++
103
104
HINTS ${binary_hint_paths}
104
105
VALIDATOR validate_binary_version)
105
- message (STATUS "found clang binary in \" ${clangpp} \" " )
106
106
find_program (opt REQUIRED
107
- NAMES opt
107
+ NAMES opt-14 opt
108
108
HINTS ${binary_hint_paths}
109
109
VALIDATOR validate_binary_version)
110
- message (STATUS "found clang binary in \" ${opt} \" " )
110
+ endif ()
111
+ if ("${clang} " STREQUAL "" )
112
+ message (FATAL_ERROR "Couldn't find clang in version 14" )
113
+ else ()
114
+ message (STATUS "found clang binary in \" ${clang} \" " )
115
+ endif ()
116
+ if ("${clangcpp} " STREQUAL "" )
117
+ message (FATAL_ERROR "Couldn't find clang++ in version 14" )
118
+ else ()
119
+ message (STATUS "found clang++ binary in \" ${clangcpp} \" " )
120
+ endif ()
121
+ if ("${opt} " STREQUAL "" )
122
+ message (FATAL_ERROR "Couldn't find opt in version 14" )
123
+ else ()
124
+ message (STATUS "found opt binary in \" ${opt} \" " )
111
125
endif ()
112
126
endif ()
113
127
0 commit comments