1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[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
This commit is contained in:
Chris Bieneman 2016-03-08 18:43:28 +00:00
parent 5c9777923f
commit 4c05063985

View File

@ -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.