[llvm-commits] [polly] r153503 - /polly/trunk/CMakeLists.txt

Hongbin Zheng etherzhhb at gmail.com
Tue Mar 27 00:56:07 PDT 2012


Author: ether
Date: Tue Mar 27 02:56:07 2012
New Revision: 153503

URL: http://llvm.org/viewvc/llvm-project?rev=153503&view=rev
Log:
Out of tree build support: Set TARGET_TRIPLE from the result of "llvm-config --host-target"
  instead of loading the "LLVMConfig.cmake" which is only installed when
  llvm configured by cmake.

Modified:
    polly/trunk/CMakeLists.txt

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=153503&r1=153502&r2=153503&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Tue Mar 27 02:56:07 2012
@@ -20,8 +20,23 @@
   # Add the llvm header path.
   include_directories(${LLVM_INSTALL_ROOT}/include/)
 
-  # Load the configuration of the installed llvm.
-  include(${LLVM_INSTALL_ROOT}/share/llvm/cmake/LLVMConfig.cmake)
+  # Get the system librarys that will link into LLVM.
+  function(get_system_libs return_var)
+    # Returns in `return_var' a list of system libraries used by LLVM.
+    if( NOT MSVC )
+      if( MINGW )
+        set(system_libs ${system_libs} imagehlp psapi)
+      elseif( CMAKE_HOST_UNIX )
+        if( HAVE_LIBDL )
+          set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
+        endif()
+        if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
+          set(system_libs ${system_libs} pthread)
+        endif()
+      endif( MINGW )
+    endif( NOT MSVC )
+    set(${return_var} ${system_libs} PARENT_SCOPE)
+  endfunction(get_system_libs)
 
   # Now set the header paths.
   execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --includedir
@@ -29,6 +44,11 @@
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
   include_directories( ${LLVM_INCLUDE_DIR} )
 
+  # Get the TARGET_TRIPLE
+  execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --host-target
+                  OUTPUT_VARIABLE TARGET_TRIPLE
+                  OUTPUT_STRIP_TRAILING_WHITESPACE)
+
   # And then set the cxx flags.
   execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --cxxflags
                   OUTPUT_VARIABLE LLVM_CXX_FLAGS





More information about the llvm-commits mailing list