summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-08-26 20:18:21 +0000
committerEric Fiselier <eric@efcs.ca>2015-08-26 20:18:21 +0000
commit961269db1b0e147dab59c187e66c48f4efd7e6d0 (patch)
tree47412128fa93c088522c9e137106fc7cf97e9b7c /cmake
parente94b4840efd092480e58259c608cf0a710e00a55 (diff)
[libcxx] Remove installation rules on Darwin when it would overwrite the system installation.
Summary: On Mac OS X overwriting `/usr/lib/libc++.dylib` can cause your computer to fail to boot. This patch tries to make it harder to do that accidentally. If `CMAKE_SYSTEM_NAME` is `Darwin` and `CMAKE_INSTALL_PREFIX` is `/usr` don't generate installation rules unless the user explicitly provides `LIBCXX_OVERRIDE_DARWIN_INSTALL=ON`. Note that `CMAKE_INSTALL_PREFIX` is always absolute so we don't need to worry about things like `/usr/../usr`. Reviewers: mclow.lists, beanz, jroelofs Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12209 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/HandleLibCXXABI.cmake12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
index 39cca9dd2..4587498dc 100644
--- a/cmake/Modules/HandleLibCXXABI.cmake
+++ b/cmake/Modules/HandleLibCXXABI.cmake
@@ -41,11 +41,13 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
file(COPY "${incpath}/${fpath}"
DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
)
- install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
- DESTINATION include/c++/v1/${dstdir}
- COMPONENT libcxx
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
- )
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
+ DESTINATION include/c++/v1/${dstdir}
+ COMPONENT libcxx
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+ endif()
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
endif()
endforeach()