From 151e266deb1eba48c81ec0d12f7ded9ebaa62ae1 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Tue, 30 Jun 2009 22:07:50 +0200 Subject: [PATCH] Yet another fix for finding llvm's config file. Since llvm-config --includedir sometimes includes the trailing llvm/ and sometimes it doesn't, we just check both directories. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1882502c..3ea3142e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,7 +143,9 @@ execute_process( # build a define that contains all LLVM targets required and is usable for # preprocessor code generation. start with the native target. -file(STRINGS ${LLVM_INCLUDEDIR}/llvm/Config/config.h LLVM_NATIVE_ARCH REGEX "^#define LLVM_NATIVE_ARCH") +find_path(LLVM_CONFIG_FILE_PATH config.h PATHS ${LLVM_INCLUDEDIR}/llvm/Config ${LLVM_INCLUDEDIR}/Config NO_DEFAULT_PATH) +message(${LLVM_CONFIG_FILE_PATH}/config.h) +file(STRINGS ${LLVM_CONFIG_FILE_PATH}/config.h LLVM_NATIVE_ARCH REGEX "^#define LLVM_NATIVE_ARCH") string(REGEX REPLACE "^#define LLVM_NATIVE_ARCH (.*)Target$" "\\1" LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}) set(LLVM_MODULES_DEFINE "LLVM_TARGET(${LLVM_NATIVE_ARCH})") # chain the extra target list to the define