include(AddLLVM)
include(TableGen)
-
-# Find all subprojects which are either enabled in a side-by-side layout, or
-# cloned into a non-side-by-side layout. Do this before adding any
-# subdirectories so that any project can check for the existence of any other
-# project. Each call takes priority over the next call, so any project which
-# is enabled via LLVM_ENABLE_PROJECTS will not have its location or enabled
-# status overwritten via a subsequent call.
-
-# First look for all projects explicitly enabled at the root.
-find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/.." "${LLVM_ENABLE_PROJECTS}")
-
-# Then pick up any projects explicitly cloned into llvm/projects or llvm/runtimes
-find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/runtimes")
-find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/projects")
-
-# Then pick up a few specific projects which can be explicit cloned into llvm/tools
-find_llvm_enabled_projects("${LLVM_SOURCE_DIR}/tools" "clang;lldb;lld")
-
-
if( MINGW )
# People report that -O3 is unreliable on MinGW. The traditional
# build also uses -O2 for that reason:
# it forces Xcode to properly link the static library.
list(APPEND ALL_FILES "${LLVM_MAIN_SRC_DIR}/cmake/dummy.cpp")
endif()
-
+
if( EXCLUDE_FROM_ALL )
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
else()
set(${output} "${nameUPPER}" PARENT_SCOPE)
endfunction(canonicalize_tool_name)
-macro(find_llvm_enabled_projects base_dir)
- set(specific_project_list "${ARGN}")
- if("${specific_project_list}" STREQUAL "")
- file(GLOB entries "${base_dir}/*")
- set(list_of_project_dirs "")
- foreach(entry ${entries})
- if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
- get_filename_component(filename "${entry}" NAME)
- list(APPEND specific_project_list "${filename}")
- endif()
- endforeach(entry)
- endif()
-
- foreach(proj ${specific_project_list})
- canonicalize_tool_name(${proj} projUPPER)
-
- if (${LLVM_PROJECT_${projUPPER}_ENABLED})
- if (EXISTS "${base_dir}/${proj}")
- message(WARNING "Project ${projUPPER} in ${base_dir}/${proj} previously found in ${LLVM_PROJECT_${projUPPER}_SOURCE_DIR}")
- endif()
- continue()
- elseif(EXISTS "${LLVM_EXTERNAL_${projUPPER}_SOURCE_DIR}")
- set(LLVM_PROJECT_${projUPPER}_ENABLED ON)
- set(LLVM_PROJECT_${projUPPER}_SOURCE_DIR "${LLVM_EXTERNAL_${projUPPER}_SOURCE_DIR}")
- elseif(EXISTS "${base_dir}/${proj}")
- set(LLVM_PROJECT_${projUPPER}_ENABLED ON)
- set(LLVM_PROJECT_${projUPPER}_SOURCE_DIR "${base_dir}/${proj}")
- endif()
- endforeach()
-endmacro()
-
# Custom add_subdirectory wrapper
# Takes in a project name (i.e. LLVM), the subdirectory name, and an optional
# path if it differs from the name.
# magic. First we grab one of the types, and a type-specific path. Then from
# the type-specific path we find the last occurrence of the type in the path,
# and replace it with CMAKE_CFG_INTDIR. This allows the build step to be type
- # agnostic again.
+ # agnostic again.
if(NOT ARG_OUTPUT_DIR)
# If you're not overriding the OUTPUT_DIR, we can make the link relative in
# the same directory.