summaryrefslogtreecommitdiffstats
path: root/libcxx/cmake
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-12-30 01:02:38 +0000
committerEric Fiselier <eric@efcs.ca>2015-12-30 01:02:38 +0000
commitbb60f19584c420e658a8f5cb63b61d382beda794 (patch)
treedb8f75904e8924e808582a7ef8b86b08727f4a59 /libcxx/cmake
parent3369867aa7a7ec4016cad188c66c51ea2264dae4 (diff)
downloadbcm5719-llvm-bb60f19584c420e658a8f5cb63b61d382beda794.tar.gz
bcm5719-llvm-bb60f19584c420e658a8f5cb63b61d382beda794.zip
Cleanup CMake for out-of-tree builds
llvm-svn: 256606
Diffstat (limited to 'libcxx/cmake')
-rw-r--r--libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake41
1 files changed, 31 insertions, 10 deletions
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index 6215be7f586..29347dc8fe1 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -1,4 +1,6 @@
-macro(find_llvm_parts)
+
+
+macro(internal_find_llvm_parts)
# Rely on llvm-config.
set(CONFIG_OUTPUT)
find_program(LLVM_CONFIG "llvm-config")
@@ -57,16 +59,13 @@ macro(find_llvm_parts)
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
set(LLVM_FOUND ON)
-endmacro(find_llvm_parts)
-
+endmacro(internal_find_llvm_parts)
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- set(LIBCXX_BUILT_STANDALONE 1)
- message(STATUS "Configuring for standalone build.")
-
- find_llvm_parts()
+macro(internal_simulate_llvm_options)
# LLVM Options --------------------------------------------------------------
+ # Configure the LLVM CMake options expected by libc++.
+
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(WARNING "Failed to find python interpreter. "
@@ -132,7 +131,29 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
MESSAGE(SEND_ERROR "Unable to determine platform")
endif(UNIX)
endif(WIN32)
+endmacro(internal_simulate_llvm_options)
+
+
+macro(handle_out_of_tree_llvm)
+ # This macro should not be called unless we are building out of tree.
+ # Enforce that.
+ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ message(FATAL_ERROR "libc++ incorrectly configured for out-of-tree LLVM")
+ endif()
+
+ # Attempt to find an LLVM installation and source directory. Warn if they
+ # are not found.
+ internal_find_llvm_parts()
+ if (NOT LLVM_FOUND)
+ message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
+ "llvm-config not found and LLVM_PATH not defined.\n"
+ "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+ "or -DLLVM_PATH=path/to/llvm-source-root.")
+ endif()
+
+ # Simulate the LLVM CMake options and variables provided by an in-tree LLVM.
+ internal_simulate_llvm_options()
- # Add LLVM Functions --------------------------------------------------------
+ # Additionally include the LLVM CMake functions if we can find the module.
include(AddLLVM OPTIONAL)
-endif()
+endmacro()
OpenPOWER on IntegriCloud