aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-11-04 19:04:39 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-11-04 19:04:39 +0000
commita0c8d2d00731ccadb799b629fcfe7eaccb3d79ab (patch)
tree249cd5c92dee80f60c66950810dc45d04bea91b0 /CMakeLists.txt
parent275f686e3b16566a4633641df3e657a298db9d9d (diff)
build/cmake: Coalesce in-tree sanity checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 17 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03ad6e2354..f4d932e152 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,11 @@ set(PACKAGE_NAME llvm)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
+# Sanity check our source directory to make sure that we are not trying to
+# generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make
+# sure that we don't have any stray generated files lying around in the tree
+# (which would end up getting picked up by header search, instead of the correct
+# versions).
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR "In-source builds are not allowed.
CMake would overwrite the makefiles distributed with LLVM.
@@ -35,27 +40,17 @@ to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them.")
endif()
-
-string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
-
-set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
-set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
-set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
-set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
-
if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
file(GLOB_RECURSE
tablegenned_files_on_include_dir
- "${LLVM_MAIN_SRC_DIR}/include/llvm/*.gen")
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/llvm/*.gen")
file(GLOB_RECURSE
tablegenned_files_on_lib_dir
- "${LLVM_MAIN_SRC_DIR}/lib/Target/*.inc")
+ "${CMAKE_CURRENT_SOURCE_DIR}/lib/Target/*.inc")
if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
message(FATAL_ERROR "Apparently there is a previous in-source build,
probably as the result of running `configure' and `make' on
-${LLVM_MAIN_SRC_DIR}.
+${CMAKE_CURRENT_SOURCE_DIR}.
This may cause problems. The suspicious files are:
${tablegenned_files_on_lib_dir}
${tablegenned_files_on_include_dir}
@@ -63,6 +58,15 @@ Please clean the source directory.")
endif()
endif()
+string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+
+set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
+set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
+set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
+set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
set(LLVM_ALL_TARGETS
ARM
CBackend