diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-10-05 14:10:17 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-10-05 14:10:17 +0000 |
commit | 1e10bd68f4f2e0514bc2979d760d41c827705e1e (patch) | |
tree | 5ae826b416727289a9b95306c356bb397811d484 /cmake | |
parent | 0559d31c374050096e1071208661f97f24dbe299 (diff) |
[CMake] Enhance add_llvm_external_project.
- Substitute hyphen to underscore, s/-/_/g, as the variable name.
- Additional parameter can be specified as the name of directory.
e.g.) add_llvm_external_project(clang-tools-extra extra)
- LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/llvm-srcroot/tools/clang/tools/extra, by default.
- Build directory is in ${CMAKE_CURRENT_BINARY_DIR}/extra
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index f44a27cce8..a999f307d5 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -135,16 +135,22 @@ endmacro(add_llvm_target) # lld, and Polly. This adds two options. One for the source directory of the # project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to # enable or disable building it with everthing else. +# Additional parameter can be specified as the name of directory. macro(add_llvm_external_project name) - string(TOUPPER ${name} nameUPPER) - set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}" + set(add_llvm_external_dir "${ARGN}") + if("${add_llvm_external_dir}" STREQUAL "") + set(add_llvm_external_dir ${name}) + endif() + string(REPLACE "-" "_" nameUNDERSCORE ${name}) + string(TOUPPER ${nameUNDERSCORE} nameUPPER) + set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}" CACHE PATH "Path to ${name} source directory") if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL "" AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt) option(LLVM_EXTERNAL_${nameUPPER}_BUILD "Whether to build ${name} as part of LLVM" ON) if (LLVM_EXTERNAL_${nameUPPER}_BUILD) - add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${name}) + add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir}) endif() endif() endmacro(add_llvm_external_project) |