diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-04-26 19:43:35 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-04-26 19:43:35 +0000 |
commit | 3c00db75e105cf6bcd8916af9e9dff52ad13148d (patch) | |
tree | bb99b7c666031d75c360f6c9203aac3c07b595f0 /tools | |
parent | 60f3d92b2a72ee420ebeed3db252b6864413f220 (diff) |
[CMake] Restructure how Clang, Polly and other external projects get included.
While making lld build under the tools directory I decided to refactor how this
works.
There is now a macro, add_llvm_external_project, which takes the name of the
expected subdirectory. This sets up two CMake options.
* LLVM_EXTERNAL_${NAME}_SOURCE_DIR
This is the path to the source. It defaults to
${CMAKE_CURRENT_SOURCE_DIR}/${name}.
* LLVM_EXTERNAL_${NAME}_BUILD
Enable and disable building the tool as part of LLVM.
I chose LLVM_EXTERNAL_${NAME} as a prefix so they all show up together in the
GUI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/CMakeLists.txt | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8294c5b232..1bfc2fe3e8 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -2,14 +2,6 @@ # three small executables. This is done to minimize memory load in parallel # builds. Please retain this ordering. -# If polly exists and is not disabled compile it and add it to the LLVM tools. -option(LLVM_BUILD_POLLY "Compile polly" ON) -if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt ) - if (LLVM_BUILD_POLLY) - add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/polly) - endif (LLVM_BUILD_POLLY) -endif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt ) - if( NOT WIN32 OR MSYS OR CYGWIN ) # We currently require 'sed' to build llvm-config, so don't try to build it # on pure Win32. @@ -56,14 +48,8 @@ if( LLVM_ENABLE_PIC ) endif() endif() -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(${LLVM_CLANG_SOURCE_DIR} clang) - endif() -endif () +add_llvm_external_project(clang) +add_llvm_external_project(lld) +add_llvm_external_project(polly) set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE) |