aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/CMake.html5
-rw-r--r--tools/CMakeLists.txt7
2 files changed, 10 insertions, 2 deletions
diff --git a/docs/CMake.html b/docs/CMake.html
index 6389c7f22a..ac07b0d6d4 100644
--- a/docs/CMake.html
+++ b/docs/CMake.html
@@ -351,6 +351,11 @@
Function Interface library. If the library or its headers are
installed on a custom location, you can set the variables
FFI_INCLUDE_DIR and FFI_LIBRARY_DIR. Defaults to OFF.</dd>
+
+ <dt><b>LLVM_CLANG_SOURCE_DIR</b>:PATH</dt>
+ <dd>Path to Clang's source directory. Defaults to tools/clang.
+ Clang will not be built when it is empty or it does not point valid
+ path.</dd>
</dl>
</div>
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index e66648bee1..3c679b82d3 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -59,11 +59,14 @@ if( LLVM_ENABLE_PIC )
endif()
endif()
-if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/clang/CMakeLists.txt )
+set(LLVM_CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clang" CACHE PATH "Path to Clang source directory")
+
+if (NOT ${LLVM_CLANG_SOURCE_DIR} STREQUAL ""
+ AND EXISTS ${LLVM_CLANG_SOURCE_DIR}/CMakeLists.txt)
option(LLVM_BUILD_CLANG "Whether to build Clang as part of LLVM" ON)
if (${LLVM_BUILD_CLANG})
add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/clang )
endif()
-endif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/clang/CMakeLists.txt )
+endif ()
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)