llvm.org GIT mirror llvm / 7c1ba5c
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262948 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 4 years ago
1 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
849849 create_subdirectory_options(LLVM TOOL)
850850 endfunction(create_llvm_tool_options)
851851
852 function(add_llvm_implicit_projects)
852 function(llvm_add_implicit_projects project)
853853 set(list_of_implicit_subdirs "")
854854 file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*")
855855 foreach(dir ${sub-dirs})
856856 if(IS_DIRECTORY "${dir}" AND EXISTS "${dir}/CMakeLists.txt")
857857 canonicalize_tool_name(${dir} name)
858 if (LLVM_TOOL_${name}_BUILD)
858 if (${project}_TOOL_${name}_BUILD)
859859 get_filename_component(fn "${dir}" NAME)
860860 list(APPEND list_of_implicit_subdirs "${fn}")
861861 endif()
863863 endforeach()
864864
865865 foreach(external_proj ${list_of_implicit_subdirs})
866 add_llvm_external_project("${external_proj}")
866 add_llvm_subdirectory(${project} TOOL "${external_proj}" ${ARGN})
867867 endforeach()
868 endfunction(llvm_add_implicit_projects)
869
870 function(add_llvm_implicit_projects)
871 llvm_add_implicit_projects(LLVM)
868872 endfunction(add_llvm_implicit_projects)
869873
870874 # Generic support for adding a unittest.