Index: cmake/modules/AddLLVM.cmake =================================================================== --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -1013,6 +1013,12 @@ set(list_of_implicit_subdirs "") file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*") foreach(dir ${sub-dirs}) + # Exclude shlib from being implicitly added. + string(FIND ${dir} llvm-shlib is_shlib) + if(NOT(${is_shlib} EQUAL -1)) + continue() + endif() + if(IS_DIRECTORY "${dir}" AND EXISTS "${dir}/CMakeLists.txt") canonicalize_tool_name(${dir} name) if (${project}_TOOL_${name}_BUILD) Index: tools/CMakeLists.txt =================================================================== --- tools/CMakeLists.txt +++ tools/CMakeLists.txt @@ -56,4 +56,8 @@ add_llvm_external_project(${p}) endforeach(p) +# Add shlib as a subdirectory. This allows directories in this folder to add +# libraries without worrying about which target will be executed first. +add_llvm_subdirectory(LLVM TOOL llvm-shlib) + set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)