[CMake] Respect LLVM_BUILD_RUNTIME.
[oota-llvm.git] / projects / CMakeLists.txt
1 # Discover the projects that use CMake in the subdirectories.
2 # Note that explicit cmake invocation is required every time a new project is
3 # added or removed.
4 file(GLOB entries *)
5 foreach(entry ${entries})
6   if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
7     if((NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt) AND
8        (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxx))
9       add_subdirectory(${entry})
10     endif()
11   endif()
12 endforeach(entry)
13
14 # Also add in the compiler-rt tree if present and we have a sufficiently
15 # recent version of CMake.
16 if(${CMAKE_VERSION} VERSION_GREATER 2.8.7 AND
17    ${LLVM_BUILD_RUNTIME} AND
18    IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt AND
19    EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt/CMakeLists.txt)
20   add_subdirectory(compiler-rt)
21 endif()