[PATCH] D38470: [CMake] Factor the setting of LLVM_BUILD_MODE to a macro so that we can re-use it in compiler-rt

Greg Bedwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 10:48:42 PDT 2017


gbedwell created this revision.
Herald added subscribers: mgorny, dberris.

This is essentially an NFC as it stands, but is required for a followup patch where the new macro is used from part of the compiler-rt CMake system.  I'll cross-reference the patches shortly.


https://reviews.llvm.org/D38470

Files:
  cmake/modules/AddLLVM.cmake


Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1107,6 +1107,15 @@
   endforeach()
 endfunction(llvm_canonicalize_cmake_booleans)
 
+macro(set_llvm_build_mode)
+  # Configuration-time: See Unit/lit.site.cfg.in
+  if (CMAKE_CFG_INTDIR STREQUAL ".")
+    set(LLVM_BUILD_MODE ".")
+  else ()
+    set(LLVM_BUILD_MODE "%(build_mode)s")
+  endif ()
+endmacro()
+
 # This function provides an automatic way to 'configure'-like generate a file
 # based on a set of common and custom variables, specifically targeting the
 # variables needed for the 'lit.site.cfg' files. This function bundles the
@@ -1130,12 +1139,7 @@
 
   set(SHLIBEXT "${LTDL_SHLIB_EXT}")
 
-  # Configuration-time: See Unit/lit.site.cfg.in
-  if (CMAKE_CFG_INTDIR STREQUAL ".")
-    set(LLVM_BUILD_MODE ".")
-  else ()
-    set(LLVM_BUILD_MODE "%(build_mode)s")
-  endif ()
+  set_llvm_build_mode()
 
   # They below might not be the build tree but provided binary tree.
   set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38470.117389.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171002/ea1e152d/attachment.bin>


More information about the llvm-commits mailing list