Home | History | Annotate | Download | only in libclang
      1 set(LLVM_USED_LIBS
      2   clangARCMigrate
      3   clangRewrite
      4   clangFrontend
      5   clangDriver
      6   clangSerialization
      7   clangIndex
      8   clangSema
      9   clangAST
     10   clangLex
     11   clangBasic)
     12 
     13 set( LLVM_LINK_COMPONENTS
     14   support
     15   mc
     16   )
     17 
     18 set(SOURCES
     19   ARCMigrate.cpp
     20   CIndex.cpp
     21   CIndexCXX.cpp
     22   CIndexCodeCompletion.cpp
     23   CIndexDiagnostic.cpp
     24   CIndexInclusionStack.cpp
     25   CIndexUSRs.cpp
     26   CIndexer.cpp
     27   CXCursor.cpp
     28   CXString.cpp
     29   CXType.cpp
     30   ../../include/clang-c/Index.h
     31   )
     32 
     33 if( LLVM_ENABLE_PIC )
     34   set(SHARED_LIBRARY TRUE)
     35   add_clang_library(libclang ${SOURCES})
     36 
     37   set_target_properties(libclang
     38     PROPERTIES
     39     OUTPUT_NAME "libclang"
     40     VERSION ${LIBCLANG_LIBRARY_VERSION}
     41     DEFINE_SYMBOL _CINDEX_LIB_)
     42 
     43   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
     44     set(LIBCLANG_LINK_FLAGS
     45       "-Wl,-compatibility_version -Wl,1 -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
     46     set_target_properties(libclang
     47       PROPERTIES
     48       LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
     49       INSTALL_NAME_DIR "@executable_path/../lib")
     50   endif()
     51 
     52   if(MSVC)
     53     # windows.h doesn't compile with /Za
     54     get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
     55     string(REPLACE "/Za" "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
     56     set_target_properties(libclang PROPERTIES
     57       COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
     58   endif()
     59 
     60   set(LIBCLANG_STATIC_TARGET_NAME libclang_static)
     61 else()
     62   set(LIBCLANG_STATIC_TARGET_NAME libclang)
     63 endif()
     64 
     65 if( NOT BUILD_SHARED_LIBS AND NOT WIN32 )
     66   add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})
     67 
     68   set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
     69     PROPERTIES
     70     OUTPUT_NAME "libclang")
     71 endif()
     72