Skip to content

Commit

Permalink
[CMake] Refactor add_llvm_implicit_projects to be reusable
Browse files Browse the repository at this point in the history
This adds llvm_add_implicit_projects which takes a project name and is wrapped by add_llvm_implicit_projects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262948 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chris Bieneman committed Mar 8, 2016
1 parent 9524e85 commit 7c1ba5c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -850,22 +850,26 @@ 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()
endif()
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.
Expand Down

0 comments on commit 7c1ba5c

Please sign in to comment.