[cmake/multilib] Teach libc++'s CMake build to support multilib libdir

suffixes like 'lib64' or 'lib32'.

This support is currently very rhudimentary. We define a variable
LIBCXX_LIBDIR_SUFFIX. In a standalone build of libc++ this can be
directly set as a cached variable to control the multilib suffix used.
When building libc++ within a larger LLVM build, it is hard wired to
whatever LLVM libdir suffix has been selected. If this doesn't work for
someone, just let me know. I'm happy to change it.

This is essentially new functionality for libc++ so I don't expect it to
have any impact for folks until they start setting these variables.
However, I know libc++ is built in a diverse set of environments so just
let me know if this causes you any problems.

llvm-svn: 224926
This commit is contained in:
Chandler Carruth 2014-12-29 12:15:47 +00:00
parent 24e9773fc5
commit 64be05a873
2 changed files with 11 additions and 4 deletions

View File

@ -27,7 +27,15 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXX_LIBDIR_SUFFIX "" CACHE STRING
"Define suffix of library directory name (32/64)")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(LIBCXX_BUILT_STANDALONE 1)
else()
set(LIBCXX_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
endif()
#===============================================================================
@ -90,11 +98,10 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib)
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
# Declare libc++ configuration variables.
# They are intended for use as follows:

View File

@ -104,6 +104,6 @@ set_target_properties(cxx
)
install(TARGETS cxx
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
)