diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/AddLLVM.cmake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 24afeea..277914f 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -146,6 +146,7 @@ macro(add_llvm_external_project name) if("${add_llvm_external_dir}" STREQUAL "") set(add_llvm_external_dir ${name}) endif() + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}") string(REPLACE "-" "_" nameUNDERSCORE ${name}) string(TOUPPER ${nameUNDERSCORE} nameUPPER) set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}" @@ -160,6 +161,34 @@ macro(add_llvm_external_project name) endif() endmacro(add_llvm_external_project) +macro(add_llvm_tool_subdirectory name) + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}") + add_subdirectory(${name}) +endmacro(add_llvm_tool_subdirectory) + +macro(ignore_llvm_tool_subdirectory name) + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}") +endmacro(ignore_llvm_tool_subdirectory) + +function(add_llvm_implicit_external_projects) + set(list_of_implicit_subdirs "") + file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*") + foreach(dir ${sub-dirs}) + if(IS_DIRECTORY "${dir}") + list(FIND LLVM_IMPLICIT_PROJECT_IGNORE "${dir}" tool_subdir_ignore) + if( tool_subdir_ignore EQUAL -1 + AND EXISTS "${dir}/CMakeLists.txt") + get_filename_component(fn "${dir}" NAME) + list(APPEND list_of_implicit_subdirs "${fn}") + endif() + endif() + endforeach() + + foreach(external_proj ${list_of_implicit_subdirs}) + add_llvm_external_project("${external_proj}") + endforeach() +endfunction(add_llvm_implicit_external_projects) + # Generic support for adding a unittest. function(add_unittest test_suite test_name) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) |