Eric Fiselier | bf9653d | 2015-03-31 04:15:45 +0000 | [diff] [blame] | 1 | set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE) |
| 2 | |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 3 | # Get sources |
Howard Hinnant | 87c61a6 | 2012-03-19 15:40:23 +0000 | [diff] [blame] | 4 | file(GLOB LIBCXX_SOURCES ../src/*.cpp) |
Howard Hinnant | 92a0700 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 5 | if(WIN32) |
Howard Hinnant | 87c61a6 | 2012-03-19 15:40:23 +0000 | [diff] [blame] | 6 | file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) |
| 7 | list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) |
Eric Fiselier | 6cb69ff | 2014-11-25 21:57:41 +0000 | [diff] [blame] | 8 | elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") |
| 9 | file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c) |
| 10 | list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES}) |
Howard Hinnant | 92a0700 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 11 | endif() |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 12 | |
| 13 | # Add all the headers to the project for IDEs. |
Eric Fiselier | 85df7a8 | 2015-12-16 23:41:05 +0000 | [diff] [blame] | 14 | if (LIBCXX_CONFIGURE_IDE) |
Howard Hinnant | 87c61a6 | 2012-03-19 15:40:23 +0000 | [diff] [blame] | 15 | file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*) |
Howard Hinnant | 92a0700 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 16 | if(WIN32) |
Howard Hinnant | 87c61a6 | 2012-03-19 15:40:23 +0000 | [diff] [blame] | 17 | file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h) |
| 18 | list(APPEND LIBCXX_HEADERS ${LIBCXX_WIN32_HEADERS}) |
Howard Hinnant | 92a0700 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 19 | endif() |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 20 | # Force them all into the headers dir on MSVC, otherwise they end up at |
| 21 | # project scope because they don't have extensions. |
| 22 | if (MSVC_IDE) |
Howard Hinnant | 87c61a6 | 2012-03-19 15:40:23 +0000 | [diff] [blame] | 23 | source_group("Header Files" FILES ${LIBCXX_HEADERS}) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 24 | endif() |
| 25 | endif() |
| 26 | |
Chris Bieneman | a846b11 | 2015-12-03 18:52:54 +0000 | [diff] [blame] | 27 | if(NOT LIBCXX_INSTALL_LIBRARY) |
| 28 | set(exclude_from_all EXCLUDE_FROM_ALL) |
| 29 | endif() |
| 30 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 31 | #if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path. |
| 32 | add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}") |
Eric Fiselier | c0b166e | 2015-03-03 15:59:51 +0000 | [diff] [blame] | 33 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 34 | add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 35 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 36 | add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,--whole-archive" "-Wl,-Bstatic") |
| 37 | add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") |
| 38 | add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" "-Wl,--no-whole-archive") |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 39 | |
Eric Fiselier | 938c96e | 2015-07-22 00:33:36 +0000 | [diff] [blame] | 40 | if (APPLE AND LLVM_USE_SANITIZER) |
| 41 | if ("${LLVM_USE_SANITIZER}" STREQUAL "Address") |
| 42 | set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib") |
| 43 | elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined") |
| 44 | set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib") |
| 45 | else() |
| 46 | message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X") |
| 47 | endif() |
| 48 | if (LIBFILE) |
| 49 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=lib OUTPUT_VARIABLE LIBDIR RESULT_VARIABLE Result) |
| 50 | if (NOT ${Result} EQUAL "0") |
| 51 | message(FATAL "Failed to find library resource directory") |
| 52 | endif() |
| 53 | string(STRIP "${LIBDIR}" LIBDIR) |
| 54 | set(LIBDIR "${LIBDIR}/darwin/") |
| 55 | if (NOT IS_DIRECTORY "${LIBDIR}") |
| 56 | message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER") |
| 57 | endif() |
| 58 | set(LIBCXX_SANITIZER_LIBRARY "${LIBDIR}/${LIBFILE}") |
| 59 | set(LIBCXX_SANITIZER_LIBRARY "${LIBCXX_SANITIZER_LIBRARY}" PARENT_SCOPE) |
| 60 | message(STATUS "Manually linking compiler-rt library: ${LIBCXX_SANITIZER_LIBRARY}") |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 61 | add_library_flags("${LIBCXX_SANITIZER_LIBRARY}") |
| 62 | add_link_flags("-Wl,-rpath,${LIBDIR}") |
Eric Fiselier | 938c96e | 2015-07-22 00:33:36 +0000 | [diff] [blame] | 63 | endif() |
| 64 | endif() |
| 65 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 66 | # Generate library list. |
| 67 | add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread) |
| 68 | add_library_flags_if(LIBCXX_HAS_C_LIB c) |
| 69 | add_library_flags_if(LIBCXX_HAS_M_LIB m) |
| 70 | add_library_flags_if(LIBCXX_HAS_RT_LIB rt) |
| 71 | add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) |
Eric Fiselier | 5432e3b | 2016-07-18 06:01:50 +0000 | [diff] [blame] | 72 | add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) |
Eric Fiselier | bf9653d | 2015-03-31 04:15:45 +0000 | [diff] [blame] | 73 | |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 74 | # Setup flags. |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 75 | add_flags_if_supported(-fPIC) |
| 76 | add_link_flags_if_supported(-nodefaultlibs) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 77 | |
Eric Fiselier | 4f274d0 | 2015-03-27 09:00:45 +0000 | [diff] [blame] | 78 | if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR |
| 79 | LIBCXX_CXX_ABI_LIBNAME STREQUAL "none")) |
Eric Fiselier | 45969ec | 2015-02-21 02:26:24 +0000 | [diff] [blame] | 80 | if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION) |
Eric Fiselier | 5fb49ff | 2016-06-14 21:55:14 +0000 | [diff] [blame] | 81 | set(LIBCXX_LIBCPPABI_VERSION "2") # Default value |
| 82 | execute_process( |
| 83 | COMMAND xcrun --show-sdk-version |
| 84 | OUTPUT_VARIABLE sdk_ver |
| 85 | RESULT_VARIABLE res |
| 86 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 87 | if (res EQUAL 0) |
| 88 | message(STATUS "Found SDK version ${sdk_ver}") |
| 89 | string(REPLACE "10." "" sdk_ver "${sdk_ver}") |
| 90 | if (sdk_ver LESS 9) |
| 91 | set(LIBCXX_LIBCPPABI_VERSION "") |
| 92 | else() |
| 93 | set(LIBCXX_LIBCPPABI_VERSION "2") |
| 94 | endif() |
| 95 | endif() |
Eric Fiselier | 45969ec | 2015-02-21 02:26:24 +0000 | [diff] [blame] | 96 | endif() |
| 97 | |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 98 | if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" ) |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 99 | add_definitions(-D__STRICT_ANSI__) |
| 100 | add_link_flags( |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 101 | "-compatibility_version 1" |
Hans Wennborg | f3b5f0e | 2014-08-12 17:32:07 +0000 | [diff] [blame] | 102 | "-current_version 1" |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 103 | "-install_name /usr/lib/libc++.1.dylib" |
| 104 | "-Wl,-reexport_library,/usr/lib/libc++abi.dylib" |
| 105 | "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" |
| 106 | "/usr/lib/libSystem.B.dylib") |
| 107 | else() |
| 108 | if ( ${CMAKE_OSX_SYSROOT} ) |
| 109 | list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7) |
| 110 | if (OSX_HAS_ARMV7) |
| 111 | set(OSX_RE_EXPORT_LINE |
| 112 | "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib" |
| 113 | "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp") |
| 114 | else() |
| 115 | set(OSX_RE_EXPORT_LINE |
| 116 | "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib") |
| 117 | endif() |
| 118 | else() |
Eric Fiselier | 25daee7 | 2015-10-05 19:28:48 +0000 | [diff] [blame] | 119 | set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp") |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 120 | endif() |
| 121 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 122 | add_link_flags( |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 123 | "-compatibility_version 1" |
| 124 | "-install_name /usr/lib/libc++.1.dylib" |
| 125 | "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" |
| 126 | "${OSX_RE_EXPORT_LINE}" |
| 127 | "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp" |
| 128 | "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp") |
| 129 | endif() |
| 130 | endif() |
| 131 | |
Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 132 | split_list(LIBCXX_COMPILE_FLAGS) |
| 133 | split_list(LIBCXX_LINK_FLAGS) |
Michael Gottesman | 8a1fc89 | 2013-09-02 07:28:03 +0000 | [diff] [blame] | 134 | |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 135 | # Add a object library that contains the compiled source files. |
| 136 | add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) |
| 137 | |
| 138 | set_target_properties(cxx_objects |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 139 | PROPERTIES |
Eric Fiselier | 8e2855c | 2014-11-15 06:26:30 +0000 | [diff] [blame] | 140 | COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 141 | ) |
| 142 | |
| 143 | set(LIBCXX_TARGETS) |
| 144 | |
| 145 | # Build the shared library. |
| 146 | if (LIBCXX_ENABLE_SHARED) |
| 147 | add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>) |
| 148 | target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) |
| 149 | set_target_properties(cxx_shared |
| 150 | PROPERTIES |
| 151 | LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
| 152 | OUTPUT_NAME "c++" |
| 153 | VERSION "${LIBCXX_ABI_VERSION}.0" |
| 154 | SOVERSION "${LIBCXX_ABI_VERSION}" |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 155 | ) |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 156 | list(APPEND LIBCXX_TARGETS "cxx_shared") |
| 157 | endif() |
| 158 | |
| 159 | # Build the static library. |
| 160 | if (LIBCXX_ENABLE_STATIC) |
| 161 | add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) |
| 162 | target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) |
| 163 | set_target_properties(cxx_static |
| 164 | PROPERTIES |
| 165 | LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
| 166 | OUTPUT_NAME "c++" |
| 167 | ) |
| 168 | list(APPEND LIBCXX_TARGETS "cxx_static") |
| 169 | endif() |
| 170 | |
| 171 | # Add a meta-target for both libraries. |
| 172 | add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) |
| 173 | |
| 174 | if (DEFINED LIBCXX_CXX_ABI_DEPS) |
| 175 | add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) |
| 176 | endif() |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 177 | |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 178 | if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
| 179 | file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) |
Eric Fiselier | 6e9a694 | 2016-06-17 19:46:40 +0000 | [diff] [blame] | 180 | if (LIBCXX_ENABLE_FILESYSTEM) |
| 181 | file(GLOB LIBCXX_FILESYSTEM_SOURCES ../src/experimental/filesystem/*.cpp) |
| 182 | endif() |
| 183 | add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES} ${LIBCXX_FILESYSTEM_SOURCES}) |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 184 | if (LIBCXX_ENABLE_SHARED) |
| 185 | target_link_libraries(cxx_experimental cxx_shared) |
| 186 | else() |
| 187 | target_link_libraries(cxx_experimental cxx_static) |
| 188 | endif() |
Eric Fiselier | 25bcc0f | 2016-05-10 16:17:43 +0000 | [diff] [blame] | 189 | |
| 190 | set(experimental_flags "${LIBCXX_COMPILE_FLAGS}") |
| 191 | check_flag_supported(-std=c++14) |
| 192 | if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG) |
| 193 | string(REPLACE "-std=c++11" "-std=c++14" experimental_flags "${LIBCXX_COMPILE_FLAGS}") |
| 194 | endif() |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 195 | set_target_properties(cxx_experimental |
| 196 | PROPERTIES |
Eric Fiselier | 25bcc0f | 2016-05-10 16:17:43 +0000 | [diff] [blame] | 197 | COMPILE_FLAGS "${experimental_flags}" |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 198 | OUTPUT_NAME "c++experimental" |
| 199 | ) |
| 200 | endif() |
| 201 | |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 202 | # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
| 203 | # after cxx builds. |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 204 | if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 205 | # Get the name of the ABI library and handle the case where CXXABI_LIBNAME |
| 206 | # is a target name and not a library. Ex cxxabi_shared. |
Eric Fiselier | a317a1b | 2015-10-14 21:20:28 +0000 | [diff] [blame] | 207 | set(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}") |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 208 | if (SCRIPT_ABI_LIBNAME STREQUAL "cxxabi_shared") |
Eric Fiselier | 1d3716a | 2015-10-15 23:04:54 +0000 | [diff] [blame] | 209 | set(SCRIPT_ABI_LIBNAME "c++abi") |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 210 | endif() |
| 211 | # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
| 212 | # after cxx builds. |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 213 | add_custom_command(TARGET cxx_shared POST_BUILD |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 214 | COMMAND |
| 215 | ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py |
| 216 | ARGS |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 217 | "$<TARGET_LINKER_FILE:cxx_shared>" |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 218 | "${SCRIPT_ABI_LIBNAME}" |
| 219 | WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} |
| 220 | ) |
| 221 | endif() |
| 222 | |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 223 | if (LIBCXX_INSTALL_LIBRARY) |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 224 | if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) |
| 225 | set(experimental_lib cxx_experimental) |
| 226 | endif() |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 227 | install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib} |
Chris Bieneman | e0620e2 | 2016-08-24 22:17:06 +0000 | [diff] [blame^] | 228 | LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx |
| 229 | ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 230 | ) |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 231 | # NOTE: This install command must go after the cxx install command otherwise |
| 232 | # it will not be executed after the library symlinks are installed. |
Petr Hosek | b640da0 | 2016-08-08 22:57:25 +0000 | [diff] [blame] | 233 | if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
Eric Fiselier | 601d2c1 | 2015-10-22 21:24:01 +0000 | [diff] [blame] | 234 | # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx> |
| 235 | # after we required CMake 3.0. |
Eric Fiselier | e6d05b6 | 2015-10-23 07:04:24 +0000 | [diff] [blame] | 236 | install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}" |
Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 +0000 | [diff] [blame] | 237 | DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} |
| 238 | COMPONENT libcxx) |
| 239 | endif() |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 240 | endif() |
Eric Fiselier | de56f74 | 2015-08-19 17:41:53 +0000 | [diff] [blame] | 241 | |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 242 | if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR |
| 243 | LIBCXX_INSTALL_HEADERS)) |
Chris Bieneman | a846b11 | 2015-12-03 18:52:54 +0000 | [diff] [blame] | 244 | if(LIBCXX_INSTALL_LIBRARY) |
Eric Fiselier | a956a10 | 2016-05-03 05:34:38 +0000 | [diff] [blame] | 245 | set(lib_install_target cxx) |
Chris Bieneman | a846b11 | 2015-12-03 18:52:54 +0000 | [diff] [blame] | 246 | endif() |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 247 | if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) |
| 248 | set(experimental_lib_install_target cxx_experimental) |
| 249 | endif() |
Chris Bieneman | ffa3db2 | 2016-04-29 22:17:15 +0000 | [diff] [blame] | 250 | if(LIBCXX_INSTALL_HEADERS) |
Chris Bieneman | e0620e2 | 2016-08-24 22:17:06 +0000 | [diff] [blame^] | 251 | set(header_install_target install-cxx-headers) |
Chris Bieneman | ffa3db2 | 2016-04-29 22:17:15 +0000 | [diff] [blame] | 252 | endif() |
Chris Bieneman | e0620e2 | 2016-08-24 22:17:06 +0000 | [diff] [blame^] | 253 | add_custom_target(install-cxx |
Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 254 | DEPENDS ${lib_install_target} |
| 255 | ${experimental_lib_install_target} |
| 256 | ${header_install_target} |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 257 | COMMAND "${CMAKE_COMMAND}" |
Chris Bieneman | e0620e2 | 2016-08-24 22:17:06 +0000 | [diff] [blame^] | 258 | -DCMAKE_INSTALL_COMPONENT=cxx |
Eric Fiselier | 961269d | 2015-08-26 20:18:21 +0000 | [diff] [blame] | 259 | -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake") |
Chris Bieneman | e0620e2 | 2016-08-24 22:17:06 +0000 | [diff] [blame^] | 260 | add_custom_target(install-libcxx DEPENDS install-cxx) |
Eric Fiselier | de56f74 | 2015-08-19 17:41:53 +0000 | [diff] [blame] | 261 | endif() |