[libcxx-commits] [PATCH] D84426: [runtimes] Build static libraries in try_compile

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 23 09:21:14 PDT 2020


ldionne created this revision.
ldionne added reviewers: smeenai, phosek.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, mgorny.
Herald added projects: libc++, libc++abi.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

Trying to build executables in try_compile leads to issues because we
might not be able to link executables for the target we're trying to
build the runtimes for. For example, when trying to build libc++ as a
static archive for some embedded targets, it might not make sense to
try and link a conventional executable for that target inside try_compile.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84426

Files:
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt


Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -7,8 +7,8 @@
 #===============================================================================
 # Setup Project
 #===============================================================================
-
 cmake_minimum_required(VERSION 3.13.4)
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -9,6 +9,7 @@
 # Setup Project
 #===============================================================================
 cmake_minimum_required(VERSION 3.13.4)
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84426.280163.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200723/979b3c69/attachment.bin>


More information about the libcxx-commits mailing list