From 4c05063985570369aa0f49c50d22ec26ba6f8d7f Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 8 Mar 2016 18:43:28 +0000 Subject: [PATCH] [CMake] Refactor add_llvm_implicit_projects to be reusable This adds llvm_add_implicit_projects which takes a project name and is wrapped by add_llvm_implicit_projects. llvm-svn: 262948 --- cmake/modules/AddLLVM.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 9e375503116..e4b0858f81d 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -850,13 +850,13 @@ function(create_llvm_tool_options) create_subdirectory_options(LLVM TOOL) endfunction(create_llvm_tool_options) -function(add_llvm_implicit_projects) +function(llvm_add_implicit_projects project) set(list_of_implicit_subdirs "") file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*") foreach(dir ${sub-dirs}) if(IS_DIRECTORY "${dir}" AND EXISTS "${dir}/CMakeLists.txt") canonicalize_tool_name(${dir} name) - if (LLVM_TOOL_${name}_BUILD) + if (${project}_TOOL_${name}_BUILD) get_filename_component(fn "${dir}" NAME) list(APPEND list_of_implicit_subdirs "${fn}") endif() @@ -864,8 +864,12 @@ function(add_llvm_implicit_projects) endforeach() foreach(external_proj ${list_of_implicit_subdirs}) - add_llvm_external_project("${external_proj}") + add_llvm_subdirectory(${project} TOOL "${external_proj}" ${ARGN}) endforeach() +endfunction(llvm_add_implicit_projects) + +function(add_llvm_implicit_projects) + llvm_add_implicit_projects(LLVM) endfunction(add_llvm_implicit_projects) # Generic support for adding a unittest.