[llvm-commits] [llvm] r143793 - /llvm/trunk/CMakeLists.txt

Daniel Dunbar daniel at zuster.org
Fri Nov 4 23:30:03 PDT 2011


Author: ddunbar
Date: Sat Nov  5 01:30:03 2011
New Revision: 143793

URL: http://llvm.org/viewvc/llvm-project?rev=143793&view=rev
Log:
build/cmake: Enable initial llvm-build integration.
 - Generates the llvm-config-2 LibraryDependencies.inc file.
 - Generates dependency information so that cmake will automatically reconfigure
   when LLVMBuild.txt files are changed.

Modified:
    llvm/trunk/CMakeLists.txt

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=143793&r1=143792&r2=143793&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sat Nov  5 01:30:03 2011
@@ -214,6 +214,54 @@
 Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
 endif()
 
+######
+# LLVMBuild Integration
+#
+# We use llvm-build to generate all the data required by the CMake based
+# build system in one swoop:
+#
+#  - We generate a file (a CMake fragment) in the object root which contains
+#    all the definitions that are required by CMake.
+#
+#  - We generate the library table used by llvm-config.
+#
+#  - We generate the dependencies for the CMake fragment, so that we will
+#    automatically reconfigure outselves.
+
+set(LLVMBUILDTOOL "${LLVM_MAIN_SRC_DIR}/utils/llvm-build/llvm-build")
+set(LLVMCONFIGLIBRARYDEPENDENCIESINC
+  "${LLVM_BINARY_DIR}/tools/llvm-config-2/LibraryDependencies.inc")
+set(LLVMBUILDCMAKEFRAG
+  "${LLVM_BINARY_DIR}/LLVMBuild.cmake")
+message(STATUS "Constructing LLVMBuild project information")
+execute_process(
+  COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
+            --write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC}
+            --write-cmake-fragment ${LLVMBUILDCMAKEFRAG}
+            ERROR_VARIABLE LLVMBUILDOUTPUT
+            ERROR_VARIABLE LLVMBUILDERRORS
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_STRIP_TRAILING_WHITESPACE
+  RESULT_VARIABLE LLVMBUILDRESULT)
+
+# On Win32, CMake doesn't properly handle piping the default output/error
+# streams into the GUI console. So, we explicitly catch and report them.
+if( NOT "${LLVMBUILDOUTPUT}" STREQUAL "")
+  message(STATUS "llvm-build output: ${LLVMBUILDOUTPUT}")
+endif()
+if( NOT "${LLVMBUILDRESULT}" STREQUAL "0" )
+  message(FATAL_ERROR
+    "Unexpected failure executing llvm-build: ${LLVMBUILDERRORS}")
+endif()
+
+# Include the generated CMake fragment. This will define properties from the
+# LLVMBuild files in a format which is easy to consume from CMake, and will add
+# the dependencies so that CMake will reconfigure properly when the LLVMBuild
+# files change.
+include(${LLVMBUILDCMAKEFRAG})
+
+######
+
 # Configure all of the various header file fragments LLVM uses which depend on
 # configuration variables.
 set(LLVM_ENUM_ASM_PRINTERS "")





More information about the llvm-commits mailing list