[cfe-commits] r127564 - /cfe/trunk/tools/libclang/CMakeLists.txt

Oscar Fuentes ofv at wanadoo.es
Sat Mar 12 20:28:29 PST 2011


Author: ofv
Date: Sat Mar 12 22:28:29 2011
New Revision: 127564

URL: http://llvm.org/viewvc/llvm-project?rev=127564&view=rev
Log:
Reverting "Build libclang as a static library too."

This reverts commit r127556. It breaks the build for MSVC.

Modified:
    cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=127564&r1=127563&r2=127564&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Sat Mar 12 22:28:29 2011
@@ -1,3 +1,5 @@
+set(SHARED_LIBRARY TRUE)
+
 set(LLVM_USED_LIBS
   clangFrontend
   clangDriver
@@ -13,7 +15,7 @@
   mc
   )
 
-set(SOURCES
+add_clang_library(libclang
   CIndex.cpp
   CIndexCXX.cpp
   CIndexCodeCompletion.cpp
@@ -25,50 +27,34 @@
   CXString.cpp
   CXType.cpp
   ../../include/clang-c/Index.h
-  )
-
-if( LLVM_ENABLE_PIC AND NOT WIN32 )
-  set(SHARED_LIBRARY TRUE)
-  add_clang_library(libclang ${SOURCES})
-
-  set_target_properties(libclang
-    PROPERTIES
-    OUTPUT_NAME "clang"
-    VERSION ${LIBCLANG_LIBRARY_VERSION}
-    DEFINE_SYMBOL _CINDEX_LIB_)
+)
 
-  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-    # Darwin-specific linker flags
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  # Darwin-specific linker flags
 
-    set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")
-
-    set(LIBCLANG_LINK_FLAGS
+  set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")
+                        
+  set(LIBCLANG_LINK_FLAGS 
       "${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
 
-    set_target_properties(libclang
-      PROPERTIES
-      LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
-      INSTALL_NAME_DIR "@executable_path/../lib")
-  endif()
-
-  set(LIBCLANG_STATIC_TARGET_NAME libclang_static)
-else()
-  set(LIBCLANG_STATIC_TARGET_NAME libclang)
+  set_target_properties(libclang
+    PROPERTIES
+    LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
+    INSTALL_NAME_DIR "@executable_path/../lib")
 endif()
 
-if( NOT BUILD_SHARED_LIBS )
-  add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})
+# Versioning information
+set_target_properties(libclang PROPERTIES VERSION ${LIBCLANG_LIBRARY_VERSION})
 
-  set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
-    PROPERTIES
-    OUTPUT_NAME "clang")
-
-  if(MSVC)
-    # windows.h doesn't compile with /Za
-    get_target_property(NON_ANSI_COMPILE_FLAGS ${LIBCLANG_STATIC_TARGET_NAME}
-      COMPILE_FLAGS)
-    string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
-    set_target_properties(${LIBCLANG_STATIC_TARGET_NAME} PROPERTIES
-      COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
-  endif()
-endif()
+if(MSVC)
+  # windows.h doesn't compile with /Za
+  get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
+  string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
+  set_target_properties(libclang PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
+endif(MSVC)
+
+set_target_properties(libclang
+  PROPERTIES
+  PREFIX ""  # Otherwise we get liblibclang.so
+  LINKER_LANGUAGE CXX
+  DEFINE_SYMBOL _CINDEX_LIB_)





More information about the cfe-commits mailing list