summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-25 06:35:15 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-25 06:35:15 +0000
commitac47bc76feafdb1d935cc9f1f9bd42e711d0f9d8 (patch)
tree76701c66bfd8e43bcbd5e73c843151b53caf243d
parentb8bb3e797c5687715c6d9d960ee573e4d0e62230 (diff)
downloadclang-ac47bc76feafdb1d935cc9f1f9bd42e711d0f9d8.tar.gz
clang-ac47bc76feafdb1d935cc9f1f9bd42e711d0f9d8.tar.bz2
clang-ac47bc76feafdb1d935cc9f1f9bd42e711d0f9d8.tar.xz
CMake build support for libCIndex and c-index-test. The indexing tests
are now running properly from within CMake. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82755 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt15
-rw-r--r--tools/CIndex/CMakeLists.txt23
-rw-r--r--tools/CMakeLists.txt2
3 files changed, 39 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ce07692aa..cdc2b9b8a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,10 +34,23 @@ macro(add_clang_library name)
../../include/clang${dir}/*.def)
set(srcs ${srcs} ${headers})
endif(MSVC_IDE OR XCODE)
- add_library( ${name} ${srcs} )
+ if (SHARED_LIBRARY)
+ set(libkind SHARED)
+ else()
+ set(libkind)
+ endif()
+ add_library( ${name} ${libkind} ${srcs} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
+ if( LLVM_LINK_COMPONENTS )
+ llvm_config(${name} ${LLVM_LINK_COMPONENTS})
+ endif( LLVM_LINK_COMPONENTS )
+ if( LLVM_USED_LIBS )
+ foreach(lib ${LLVM_USED_LIBS})
+ target_link_libraries( ${name} ${lib} )
+ endforeach(lib)
+ endif( LLVM_USED_LIBS )
add_dependencies(${name} ClangDiagnosticCommon)
if(MSVC)
get_target_property(cflag ${name} COMPILE_FLAGS)
diff --git a/tools/CIndex/CMakeLists.txt b/tools/CIndex/CMakeLists.txt
new file mode 100644
index 0000000000..6f4122b00b
--- /dev/null
+++ b/tools/CIndex/CMakeLists.txt
@@ -0,0 +1,23 @@
+set(SHARED_LIBRARY TRUE)
+
+set(LLVM_NO_RTTI 1)
+
+set(LLVM_USED_LIBS
+ clangFrontend clangIndex clangSema clangAST clangLex clangBasic)
+
+set( LLVM_LINK_COMPONENTS
+ MC
+ support
+ )
+
+add_clang_library(CIndex CIndex.cpp)
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # FIXME: Deal with LLVM_SUBMIT_VERSION?
+
+ set_target_properties(CIndex
+ PROPERTIES
+ LINK_FLAGS "-avoid-version -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_SOURCE_DIR}/CIndex.exports -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000"
+ INSTALL_NAME_DIR "@executable_path/../lib"
+ )
+endif()
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 91039e05df..222512af15 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -5,3 +5,5 @@ option(CLANG_BUILD_EXPERIMENTAL "Build experimenal Clang tools" OFF)
if (CLANG_BUILD_EXPERIMENTAL)
add_subdirectory(wpa)
endif ()
+add_subdirectory(CIndex)
+add_subdirectory(c-index-test)