aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-04-09 15:12:48 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-04-20 05:40:26 +0000
commitb074d562ad142d349fd44a2b72c03005025325cd (patch)
tree2926abe045845dc059eec5e0b4b091b785841e5e /sources
parent978b096849af36c9e82c118e189ea9614ee0fdd0 (diff)
Improve CMake clang detection logic
Before calling llvm_config, check that the path to llvm_config is non-empty. Otherwise exit early. Change-Id: Ibde88bbcc6a1c6324b2a0cbb1b62f894a7aae42c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index e774a172b..b65e32974 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -56,6 +56,9 @@ endmacro()
set(CLANG_DIR "")
set(CLANG_DIR_SOURCE "")
+set(clang_not_found_message "Unable to detect CLANG location by checking LLVM_INSTALL_DIR, \
+ CLANG_INSTALL_DIR or running llvm-config.")
+
if (DEFINED ENV{LLVM_INSTALL_DIR})
set(CLANG_DIR $ENV{LLVM_INSTALL_DIR})
string(REPLACE "_ARCH_" "${PYTHON_ARCH}" CLANG_DIR "${CLANG_DIR}")
@@ -69,6 +72,10 @@ else ()
get_llvm_config()
endif()
set(CLANG_DIR_SOURCE "${LLVM_CONFIG}")
+ if ("${CLANG_DIR_SOURCE}" STREQUAL "")
+ message(FATAL_ERROR "${clang_not_found_message}")
+ endif()
+
EXEC_PROGRAM("${LLVM_CONFIG}" ARGS "--prefix" OUTPUT_VARIABLE CLANG_DIR)
if (NOT "${CLANG_DIR}" STREQUAL "")
EXEC_PROGRAM("${LLVM_CONFIG}" ARGS "--version" OUTPUT_VARIABLE CLANG_VERSION)
@@ -79,7 +86,7 @@ else ()
endif()
if ("${CLANG_DIR}" STREQUAL "")
- message(FATAL_ERROR "Unable to detect CLANG location by checking LLVM_INSTALL_DIR, CLANG_INSTALL_DIR or running llvm-config.")
+ message(FATAL_ERROR "${clang_not_found_message}")
elseif (NOT IS_DIRECTORY ${CLANG_DIR})
message(FATAL_ERROR "${CLANG_DIR} detected by ${CLANG_DIR_SOURCE} does not exist.")
endif()