[StreamExecutor] Make SE work with an in-tree LLVM build.
[lldb.git] / parallel-libs / streamexecutor / CMakeLists.txt
index fde628f..c290104 100644 (file)
@@ -38,9 +38,9 @@ if(STREAM_EXECUTOR_STANDALONE)
         OUTPUT_STRIP_TRAILING_WHITESPACE)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS}")
 
-    # Find the libraries that correspond to the LLVM components
-    # that we wish to use
-    llvm_map_components_to_libnames(llvm_libs support symbolize)
+    set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+    include(AddLLVM)
 
     if(STREAM_EXECUTOR_UNIT_TESTS)
         enable_testing()
@@ -55,6 +55,10 @@ else(NOT STREAM_EXECUTOR_STANDALONE)
     endif()
 endif(STREAM_EXECUTOR_STANDALONE)
 
+# Find the libraries that correspond to the LLVM components
+# that we wish to use
+llvm_map_components_to_libnames(llvm_libs support symbolize)
+
 # Insist on C++ 11 features.
 set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -65,6 +69,10 @@ set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
 add_subdirectory(lib)
 add_subdirectory(examples)
 
+if(STREAM_EXECUTOR_UNIT_TESTS)
+    add_subdirectory(unittests)
+endif()
+
 if(STREAM_EXECUTOR_ENABLE_CONFIG_TOOL )
     add_subdirectory(tools/streamexecutor-config)
 endif(STREAM_EXECUTOR_ENABLE_CONFIG_TOOL )