[PATCH] D89177: [cmake] Add support for multiple distributions

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 10:58:46 PDT 2020


phosek added a comment.
Herald added a subscriber: rdzhabarov.

We've already considered introducing a similar mechanism so thank you for working on this! There's one issue that I haven't figured out how to resolve and I'd be interested in your thoughts: building executables and libraries in the most optimal may require incompatible flags. For example, when building a shared library you have to use `-fPIC` but for executables that's suboptimal; similarly, when building executables you may want to use LTO but if you also want to create a distribution that contains static libraries, that's a problem because those will contain bitcode. So far our solution has been to simply do multiple builds with different flags (in GN this can be done in a single build by leveraging the "toolchain" concept that also allows sharing as much work as possible, but I haven't figured out how to do anything like that in CMake).



================
Comment at: llvm/cmake/modules/LLVMDistributionSupport.cmake:39
+    # default (unnamed) distribution.
+    set_property(GLOBAL PROPERTY LLVM_DISTRIBUTION_FOR_${target} " ")
+  endforeach()
----------------
Can we use `EMPTY` or something along those lines to make it more obvious?


================
Comment at: llvm/cmake/modules/LLVMDistributionSupport.cmake:186
+    # the latter and fix it in the loop.
+    set(distributions " ")
+  endif()
----------------
Can we use `EMPTY` or something along those lines to make it more obvious?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89177/new/

https://reviews.llvm.org/D89177



More information about the cfe-commits mailing list