Eric Fiselier | 78fdf2d | 2015-03-31 04:15:45 | [diff] [blame] | 1 | set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE) |
| 2 | |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 3 | # Get sources |
Howard Hinnant | b2f52bb | 2012-03-19 15:40:23 | [diff] [blame] | 4 | file(GLOB LIBCXX_SOURCES ../src/*.cpp) |
Howard Hinnant | 3c78ca0 | 2011-09-22 19:10:18 | [diff] [blame] | 5 | if(WIN32) |
Howard Hinnant | b2f52bb | 2012-03-19 15:40:23 | [diff] [blame] | 6 | file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) |
| 7 | list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) |
Eric Fiselier | 53deb60 | 2014-11-25 21:57:41 | [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 | 3c78ca0 | 2011-09-22 19:10:18 | [diff] [blame] | 11 | endif() |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 12 | |
| 13 | # Add all the headers to the project for IDEs. |
Eric Fiselier | 6627c70 | 2015-12-16 23:41:05 | [diff] [blame] | 14 | if (LIBCXX_CONFIGURE_IDE) |
Howard Hinnant | b2f52bb | 2012-03-19 15:40:23 | [diff] [blame] | 15 | file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*) |
Howard Hinnant | 3c78ca0 | 2011-09-22 19:10:18 | [diff] [blame] | 16 | if(WIN32) |
Howard Hinnant | b2f52bb | 2012-03-19 15:40:23 | [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 | 3c78ca0 | 2011-09-22 19:10:18 | [diff] [blame] | 19 | endif() |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [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 | b2f52bb | 2012-03-19 15:40:23 | [diff] [blame] | 23 | source_group("Header Files" FILES ${LIBCXX_HEADERS}) |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 24 | endif() |
| 25 | endif() |
| 26 | |
Chris Bieneman | a1b79ae | 2015-12-03 18:52:54 | [diff] [blame] | 27 | if(NOT LIBCXX_INSTALL_LIBRARY) |
| 28 | set(exclude_from_all EXCLUDE_FROM_ALL) |
| 29 | endif() |
| 30 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [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 | 0357171 | 2015-03-03 15:59:51 | [diff] [blame] | 33 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 34 | add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 35 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [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 | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 39 | |
Eric Fiselier | d1bac4c | 2015-07-22 00:33:36 | [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 | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 61 | add_library_flags("${LIBCXX_SANITIZER_LIBRARY}") |
| 62 | add_link_flags("-Wl,-rpath,${LIBDIR}") |
Eric Fiselier | d1bac4c | 2015-07-22 00:33:36 | [diff] [blame] | 63 | endif() |
| 64 | endif() |
| 65 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [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 | a23470e | 2016-07-18 06:01:50 | [diff] [blame] | 72 | add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) |
Eric Fiselier | 78fdf2d | 2015-03-31 04:15:45 | [diff] [blame] | 73 | |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 74 | # Setup flags. |
Saleem Abdulrasool | 394d351 | 2016-09-01 20:49:54 | [diff] [blame] | 75 | if (NOT WIN32) |
| 76 | add_flags_if_supported(-fPIC) |
| 77 | endif() |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 78 | add_link_flags_if_supported(-nodefaultlibs) |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 79 | |
Eric Fiselier | e035c7c | 2015-03-27 09:00:45 | [diff] [blame] | 80 | if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR |
| 81 | LIBCXX_CXX_ABI_LIBNAME STREQUAL "none")) |
Eric Fiselier | d2852b6 | 2015-02-21 02:26:24 | [diff] [blame] | 82 | if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION) |
Eric Fiselier | a0dd664 | 2016-06-14 21:55:14 | [diff] [blame] | 83 | set(LIBCXX_LIBCPPABI_VERSION "2") # Default value |
| 84 | execute_process( |
| 85 | COMMAND xcrun --show-sdk-version |
| 86 | OUTPUT_VARIABLE sdk_ver |
| 87 | RESULT_VARIABLE res |
| 88 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 89 | if (res EQUAL 0) |
| 90 | message(STATUS "Found SDK version ${sdk_ver}") |
| 91 | string(REPLACE "10." "" sdk_ver "${sdk_ver}") |
| 92 | if (sdk_ver LESS 9) |
| 93 | set(LIBCXX_LIBCPPABI_VERSION "") |
| 94 | else() |
| 95 | set(LIBCXX_LIBCPPABI_VERSION "2") |
| 96 | endif() |
| 97 | endif() |
Eric Fiselier | d2852b6 | 2015-02-21 02:26:24 | [diff] [blame] | 98 | endif() |
| 99 | |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 100 | if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" ) |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 101 | add_definitions(-D__STRICT_ANSI__) |
| 102 | add_link_flags( |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 103 | "-compatibility_version 1" |
Hans Wennborg | 4714826 | 2014-08-12 17:32:07 | [diff] [blame] | 104 | "-current_version 1" |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 105 | "-install_name /usr/lib/libc++.1.dylib" |
| 106 | "-Wl,-reexport_library,/usr/lib/libc++abi.dylib" |
| 107 | "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" |
| 108 | "/usr/lib/libSystem.B.dylib") |
| 109 | else() |
Eric Fiselier | 2112586 | 2016-08-30 00:54:37 | [diff] [blame] | 110 | if (DEFINED CMAKE_OSX_SYSROOT) |
Eric Fiselier | 7a05dfa | 2016-08-30 01:10:33 | [diff] [blame] | 111 | list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7) |
Eric Fiselier | 2112586 | 2016-08-30 00:54:37 | [diff] [blame] | 112 | if (NOT OSX_HAS_ARMV7 EQUAL -1) |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 113 | set(OSX_RE_EXPORT_LINE |
| 114 | "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib" |
| 115 | "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp") |
| 116 | else() |
| 117 | set(OSX_RE_EXPORT_LINE |
| 118 | "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib") |
| 119 | endif() |
| 120 | else() |
Eric Fiselier | 9dbb558 | 2015-10-05 19:28:48 | [diff] [blame] | 121 | 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 | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 122 | endif() |
| 123 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 124 | add_link_flags( |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 125 | "-compatibility_version 1" |
| 126 | "-install_name /usr/lib/libc++.1.dylib" |
| 127 | "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" |
| 128 | "${OSX_RE_EXPORT_LINE}" |
| 129 | "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp" |
| 130 | "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp") |
| 131 | endif() |
| 132 | endif() |
| 133 | |
Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 | [diff] [blame] | 134 | split_list(LIBCXX_COMPILE_FLAGS) |
| 135 | split_list(LIBCXX_LINK_FLAGS) |
Michael Gottesman | 05c4b55 | 2013-09-02 07:28:03 | [diff] [blame] | 136 | |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 137 | # Add a object library that contains the compiled source files. |
| 138 | add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) |
| 139 | |
| 140 | set_target_properties(cxx_objects |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 141 | PROPERTIES |
Eric Fiselier | 5aedca9 | 2014-11-15 06:26:30 | [diff] [blame] | 142 | COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 143 | ) |
| 144 | |
| 145 | set(LIBCXX_TARGETS) |
| 146 | |
| 147 | # Build the shared library. |
| 148 | if (LIBCXX_ENABLE_SHARED) |
| 149 | add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>) |
| 150 | target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) |
| 151 | set_target_properties(cxx_shared |
| 152 | PROPERTIES |
| 153 | LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
| 154 | OUTPUT_NAME "c++" |
| 155 | VERSION "${LIBCXX_ABI_VERSION}.0" |
| 156 | SOVERSION "${LIBCXX_ABI_VERSION}" |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 157 | ) |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 158 | list(APPEND LIBCXX_TARGETS "cxx_shared") |
| 159 | endif() |
| 160 | |
| 161 | # Build the static library. |
| 162 | if (LIBCXX_ENABLE_STATIC) |
| 163 | add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) |
| 164 | target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) |
| 165 | set_target_properties(cxx_static |
| 166 | PROPERTIES |
| 167 | LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
| 168 | OUTPUT_NAME "c++" |
| 169 | ) |
| 170 | list(APPEND LIBCXX_TARGETS "cxx_static") |
| 171 | endif() |
| 172 | |
| 173 | # Add a meta-target for both libraries. |
| 174 | add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) |
| 175 | |
| 176 | if (DEFINED LIBCXX_CXX_ABI_DEPS) |
| 177 | add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) |
| 178 | endif() |
Michael J. Spencer | f5799be | 2010-12-10 19:47:54 | [diff] [blame] | 179 | |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 180 | if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
| 181 | file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) |
Eric Fiselier | c797958 | 2016-06-17 19:46:40 | [diff] [blame] | 182 | if (LIBCXX_ENABLE_FILESYSTEM) |
| 183 | file(GLOB LIBCXX_FILESYSTEM_SOURCES ../src/experimental/filesystem/*.cpp) |
| 184 | endif() |
| 185 | add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES} ${LIBCXX_FILESYSTEM_SOURCES}) |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 186 | if (LIBCXX_ENABLE_SHARED) |
| 187 | target_link_libraries(cxx_experimental cxx_shared) |
| 188 | else() |
| 189 | target_link_libraries(cxx_experimental cxx_static) |
| 190 | endif() |
Eric Fiselier | a5e201f | 2016-05-10 16:17:43 | [diff] [blame] | 191 | |
| 192 | set(experimental_flags "${LIBCXX_COMPILE_FLAGS}") |
| 193 | check_flag_supported(-std=c++14) |
| 194 | if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG) |
| 195 | string(REPLACE "-std=c++11" "-std=c++14" experimental_flags "${LIBCXX_COMPILE_FLAGS}") |
| 196 | endif() |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 197 | set_target_properties(cxx_experimental |
| 198 | PROPERTIES |
Eric Fiselier | a5e201f | 2016-05-10 16:17:43 | [diff] [blame] | 199 | COMPILE_FLAGS "${experimental_flags}" |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 200 | OUTPUT_NAME "c++experimental" |
| 201 | ) |
| 202 | endif() |
| 203 | |
Asiri Rathnayake | 8c2bf45 | 2016-09-11 21:46:40 | [diff] [blame^] | 204 | if (LIBCXX_HAS_EXTERNAL_THREAD_API) |
| 205 | file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp) |
| 206 | |
| 207 | if (LIBCXX_ENABLE_SHARED) |
| 208 | add_library(cxx_external_threads SHARED ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES}) |
| 209 | else() |
| 210 | add_library(cxx_external_threads STATIC ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES}) |
| 211 | endif() |
| 212 | |
| 213 | set_target_properties(cxx_external_threads |
| 214 | PROPERTIES |
| 215 | LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
| 216 | COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" |
| 217 | OUTPUT_NAME "c++external_threads" |
| 218 | ) |
| 219 | endif() |
| 220 | |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 221 | # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
| 222 | # after cxx builds. |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 223 | if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 224 | # Get the name of the ABI library and handle the case where CXXABI_LIBNAME |
| 225 | # is a target name and not a library. Ex cxxabi_shared. |
Eric Fiselier | 27dec39 | 2015-10-14 21:20:28 | [diff] [blame] | 226 | set(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}") |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 227 | if (SCRIPT_ABI_LIBNAME STREQUAL "cxxabi_shared") |
Eric Fiselier | a15785b | 2015-10-15 23:04:54 | [diff] [blame] | 228 | set(SCRIPT_ABI_LIBNAME "c++abi") |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 229 | endif() |
| 230 | # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
| 231 | # after cxx builds. |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 232 | add_custom_command(TARGET cxx_shared POST_BUILD |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 233 | COMMAND |
| 234 | ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py |
| 235 | ARGS |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 236 | "$<TARGET_LINKER_FILE:cxx_shared>" |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 237 | "${SCRIPT_ABI_LIBNAME}" |
| 238 | WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} |
| 239 | ) |
| 240 | endif() |
| 241 | |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 242 | if (LIBCXX_INSTALL_LIBRARY) |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 243 | if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) |
| 244 | set(experimental_lib cxx_experimental) |
| 245 | endif() |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 246 | install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib} |
Chris Bieneman | f17227a | 2016-08-24 22:17:06 | [diff] [blame] | 247 | LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx |
| 248 | ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 249 | ) |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 250 | # NOTE: This install command must go after the cxx install command otherwise |
| 251 | # it will not be executed after the library symlinks are installed. |
Petr Hosek | 9e49a33 | 2016-08-08 22:57:25 | [diff] [blame] | 252 | if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
Eric Fiselier | e2dd2fd | 2015-10-22 21:24:01 | [diff] [blame] | 253 | # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx> |
| 254 | # after we required CMake 3.0. |
Eric Fiselier | cae21e4 | 2015-10-23 07:04:24 | [diff] [blame] | 255 | install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}" |
Eric Fiselier | 8241405 | 2015-10-14 19:54:03 | [diff] [blame] | 256 | DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} |
| 257 | COMPONENT libcxx) |
| 258 | endif() |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 259 | endif() |
Eric Fiselier | 7cb813f | 2015-08-19 17:41:53 | [diff] [blame] | 260 | |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 261 | if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR |
| 262 | LIBCXX_INSTALL_HEADERS)) |
Chris Bieneman | a1b79ae | 2015-12-03 18:52:54 | [diff] [blame] | 263 | if(LIBCXX_INSTALL_LIBRARY) |
Eric Fiselier | 59e9748 | 2016-05-03 05:34:38 | [diff] [blame] | 264 | set(lib_install_target cxx) |
Chris Bieneman | a1b79ae | 2015-12-03 18:52:54 | [diff] [blame] | 265 | endif() |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 266 | if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) |
| 267 | set(experimental_lib_install_target cxx_experimental) |
| 268 | endif() |
Chris Bieneman | 4497e3a | 2016-04-29 22:17:15 | [diff] [blame] | 269 | if(LIBCXX_INSTALL_HEADERS) |
Chris Bieneman | f17227a | 2016-08-24 22:17:06 | [diff] [blame] | 270 | set(header_install_target install-cxx-headers) |
Chris Bieneman | 4497e3a | 2016-04-29 22:17:15 | [diff] [blame] | 271 | endif() |
Chris Bieneman | f17227a | 2016-08-24 22:17:06 | [diff] [blame] | 272 | add_custom_target(install-cxx |
Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 | [diff] [blame] | 273 | DEPENDS ${lib_install_target} |
| 274 | ${experimental_lib_install_target} |
| 275 | ${header_install_target} |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 276 | COMMAND "${CMAKE_COMMAND}" |
Chris Bieneman | f17227a | 2016-08-24 22:17:06 | [diff] [blame] | 277 | -DCMAKE_INSTALL_COMPONENT=cxx |
Eric Fiselier | d77135f | 2015-08-26 20:18:21 | [diff] [blame] | 278 | -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake") |
Chris Bieneman | f17227a | 2016-08-24 22:17:06 | [diff] [blame] | 279 | add_custom_target(install-libcxx DEPENDS install-cxx) |
Eric Fiselier | 7cb813f | 2015-08-19 17:41:53 | [diff] [blame] | 280 | endif() |