[PATCH] D23958: cmake: Install gtest lib&headers, to use in stand-alone builds

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 27 07:22:11 PDT 2016


mgorny created this revision.
mgorny added reviewers: delcypher, Bigcheese, vsk, chapuni.
mgorny added a subscriber: llvm-commits.

Install gtest & gtest_main libraries and the gtest headers in dedicated subdirectories to support stand-alone builds of external LLVM projects. Use dedicated subdirectories in order to clearly indicate that the files are not parts of the LLVM API and avoid collisions with other packages (and system-wide installs of gtest).

The libraries are installed to 'llvm' subdirectory of library directory, while the headers are installed to 'llvm-gtest' subdirectory of header directory. The library names are unchanged so that all existing rules in LLVM and external projects continue to work. Additional target checks are added to unittests subdirectory to prevent target collisions in
external projects adding the utils/unittest directory to their CMake build.

Full compatibility for existing builds is preserved, both for combined builds of LLVM and subprojects, and for stand-alone builds done using LLVM source directory. In the latter case, the installed gtest library will be preferred over building another one if available. Additionally, it is now possible to do unittest builds in external projects against
installed LLVM after adding the necessary include directory.

// I'm going to post a matching patch for clang in a minute and link it //

https://reviews.llvm.org/D23958

Files:
  cmake/modules/AddLLVM.cmake
  utils/unittest/CMakeLists.txt
  utils/unittest/UnitTestMain/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23958.69487.patch
Type: text/x-patch
Size: 3999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160827/09e1a86b/attachment.bin>


More information about the llvm-commits mailing list