aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFarzad Sadeghi <thabogre@gmail.com>2021-08-03 12:37:21 +0000
committerGitHub <noreply@github.com>2021-08-03 12:37:21 +0000
commitf7a0be5e16b12c68b20700ac469c8b9b9ee1d568 (patch)
treea43c483fe9421c8b96c35e576922805009c3315b
parentfix for llvm 13 (diff)
parent[patch] Use a reasonable fallback for LLVM_CONF (diff)
downloadcgrep-f7a0be5e16b12c68b20700ac469c8b9b9ee1d568.tar.gz
cgrep-f7a0be5e16b12c68b20700ac469c8b9b9ee1d568.zip
Merge pull request #20 from schra/patch/llvm-conf
Use a reasonable fallback for LLVM_CONF
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d144b7b..18a1c9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,19 @@ cmake_minimum_required(VERSION 3.14.5)
project(cgrep VERSION 1.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
-set(LLVM_CONF llvm-config-10 CACHE STRING "set the actual name of llvm-config, i.e. llvm-config-10")
+set(LLVM_CONF "" CACHE STRING "set the actual name of llvm-config, i.e. llvm-config-10")
+
+set(LLVM_CONF_TMP "${LLVM_CONF}")
+unset(LLVM_CONF CACHE)
+
+if(LLVM_CONF_TMP STREQUAL "")
+ # If LLVM_CONF wasn't provided, search for it.
+ find_program(LLVM_CONF NAMES llvm-config llvm-config-12 llvm-config-11 llvm-config-10 REQUIRED)
+else()
+ # If LLVM_CONF was provided, check if the executable actually exists.
+ find_program(LLVM_CONF NAMES "${LLVM_CONF_TMP}" REQUIRED)
+endif()
+unset(LLVM_CONF_TMP)
function(CleanMessage)
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGN}")