https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/171678
This patch removes explicit dependencies on cxx_experimental for installations that are local to the test suite. Such dependencies are not required anymore from the test-suite installation targets since the proper dependency is now encoded between cxx and cxx_experimental. >From 1918128fd4ea2b194b7eb607726ae246f032aecf Mon Sep 17 00:00:00 2001 From: Louis Dionne <[email protected]> Date: Wed, 10 Dec 2025 13:29:44 -0500 Subject: [PATCH 1/3] [runtimes] Modernize installation targets This patch moves away from using cmake_install scripts to install the various targets when building runtimes, since those have been deprecated by CMake. Instead, we use `cmake --install` which is the prefered method. This patch also localizes how we set dependencies on the various installation targets, allowing the removal of a few global variables that were used as lists. Finally, it makes the way we set up installation targets for libc++, libc++abi and libunwind consistent again. --- libcxx/include/CMakeLists.txt | 6 +-- libcxx/modules/CMakeLists.txt | 6 +-- libcxx/src/CMakeLists.txt | 67 +++++++++++++++----------------- libcxxabi/include/CMakeLists.txt | 6 +-- libcxxabi/src/CMakeLists.txt | 57 ++++++++++++++------------- libunwind/include/CMakeLists.txt | 6 +-- libunwind/src/CMakeLists.txt | 50 ++++++++++++------------ 7 files changed, 92 insertions(+), 106 deletions(-) diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index cbcd764e67d93..19732016ee411 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -1751,10 +1751,8 @@ if (LIBCXX_INSTALL_HEADERS) if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-cxx-headers - DEPENDS cxx-headers - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-headers - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + DEPENDS cxx-headers + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxx-headers) # Stripping is a no-op for headers add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers) endif() diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt index d47d19a475531..6486bcfce3ea8 100644 --- a/libcxx/modules/CMakeLists.txt +++ b/libcxx/modules/CMakeLists.txt @@ -259,10 +259,8 @@ if (LIBCXX_INSTALL_MODULES) if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-cxx-modules - DEPENDS cxx-modules - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-modules - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + DEPENDS cxx-modules + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxx-modules) # Stripping is a no-op for modules add_custom_target(install-cxx-modules-stripped DEPENDS install-cxx-modules) endif() diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index f59fe0e08fccb..03349fb38afa5 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -244,10 +244,6 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) ) endif() -if (LIBCXX_ENABLE_SHARED) - list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared") -endif() - if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") # Since we most likely do not have a mt.exe replacement, disable the # manifest bundling. This allows a normal cmake invocation to pass which @@ -295,17 +291,11 @@ if (LIBCXX_HERMETIC_STATIC_LIBRARY) target_compile_definitions(cxx_static PRIVATE _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=) endif() -if (LIBCXX_ENABLE_STATIC) - list(APPEND LIBCXX_BUILD_TARGETS "cxx_static") -endif() # Attempt to merge the libc++.a archive and the ABI library archive into one. if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY) target_link_libraries(cxx_static PRIVATE libcxx-abi-static-objects) endif() -# Add a meta-target for both libraries. -add_custom_target(cxx DEPENDS ${LIBCXX_BUILD_TARGETS}) - # Build the experimental static library set(LIBCXX_EXPERIMENTAL_SOURCES experimental/keep.cpp @@ -355,6 +345,15 @@ set_target_properties(cxx_experimental cxx_add_common_build_flags(cxx_experimental) target_compile_options(cxx_experimental PUBLIC -D_LIBCPP_ENABLE_EXPERIMENTAL) +# Add a meta-target for both libraries. +add_custom_target(cxx) +if (LIBCXX_ENABLE_SHARED) + add_dependencies(cxx cxx_shared) +endif() +if (LIBCXX_ENABLE_STATIC) + add_dependencies(cxx cxx_static) +endif() + if (LIBCXX_INSTALL_SHARED_LIBRARY) install(TARGETS cxx_shared ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx @@ -385,30 +384,26 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) endif() if (NOT CMAKE_CONFIGURATION_TYPES) - if(LIBCXX_INSTALL_LIBRARY) - set(lib_install_target "cxx;cxx_experimental") - endif() - if(LIBCXX_INSTALL_HEADERS) - set(header_install_target install-cxx-headers) - endif() - if(LIBCXX_INSTALL_MODULES) - set(module_install_target install-cxx-modules) - endif() - add_custom_target(install-cxx - DEPENDS ${lib_install_target} - cxx_experimental - ${header_install_target} - ${module_install_target} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx - -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake") - add_custom_target(install-cxx-stripped - DEPENDS ${lib_install_target} - cxx_experimental - ${header_install_target} - ${module_install_target} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx - -DCMAKE_INSTALL_DO_STRIP=1 - -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake") + add_custom_target(install-cxx + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxx) + add_custom_target(install-cxx-stripped + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxx --strip) + + add_dependencies(install-cxx cxx_experimental) + add_dependencies(install-cxx-stripped cxx_experimental) + + if (LIBCXX_INSTALL_LIBRARY) + add_dependencies(install-cxx cxx) + add_dependencies(install-cxx-stripped cxx) + endif() + + if(LIBCXX_INSTALL_HEADERS) + add_dependencies(install-cxx install-cxx-headers) + add_dependencies(install-cxx-stripped install-cxx-headers-stripped) + endif() + + if(LIBCXX_INSTALL_MODULES) + add_dependencies(install-cxx install-cxx-modules) + add_dependencies(install-cxx-stripped install-cxx-modules-stripped) + endif() endif() diff --git a/libcxxabi/include/CMakeLists.txt b/libcxxabi/include/CMakeLists.txt index 5b1cc2545016e..cc32c12a40e05 100644 --- a/libcxxabi/include/CMakeLists.txt +++ b/libcxxabi/include/CMakeLists.txt @@ -30,10 +30,8 @@ if (LIBCXXABI_INSTALL_HEADERS) endforeach() add_custom_target(install-cxxabi-headers - DEPENDS cxxabi-headers - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi-headers - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + DEPENDS cxxabi-headers + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxxabi-headers) # Stripping is a no-op for headers add_custom_target(install-cxxabi-headers-stripped DEPENDS install-cxxabi-headers) endif() diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index 38a54b16278a7..88ae36e8310fd 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -219,13 +219,6 @@ target_link_libraries(cxxabi_shared PUBLIC cxxabi_shared_objects runtimes-libc-shared PRIVATE ${LIBCXXABI_LIBRARIES}) -if (LIBCXXABI_ENABLE_SHARED) -list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared") -endif() -if (LIBCXXABI_INSTALL_SHARED_LIBRARY) -list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared") -endif() - # TODO: Move this to libc++'s HandleLibCXXABI.cmake since this is effectively trying to control # what libc++ re-exports. add_library(cxxabi-reexports INTERFACE) @@ -325,34 +318,42 @@ target_link_libraries(cxxabi_static PUBLIC cxxabi_static_objects PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES}) -if (LIBCXXABI_ENABLE_STATIC) - list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_static") +# Add a meta-target for both libraries. +add_custom_target(cxxabi) +if (LIBCXXABI_ENABLE_SHARED) + add_dependencies(cxxabi cxxabi_shared) endif() -if (LIBCXXABI_INSTALL_STATIC_LIBRARY) - list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static") +if (LIBCXXABI_ENABLE_STATIC) + add_dependencies(cxxabi cxxabi_static) endif() -# Add a meta-target for both libraries. -add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS}) - -if (LIBCXXABI_INSTALL_LIBRARY) - install(TARGETS ${LIBCXXABI_INSTALL_TARGETS} +if (LIBCXXABI_INSTALL_SHARED_LIBRARY) + install(TARGETS cxxabi_shared + ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi LIBRARY DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi + RUNTIME DESTINATION ${LIBCXXABI_INSTALL_RUNTIME_DIR} COMPONENT cxxabi) +endif() + +if (LIBCXXABI_INSTALL_STATIC_LIBRARY) + install(TARGETS cxxabi_static ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi - RUNTIME DESTINATION ${LIBCXXABI_INSTALL_RUNTIME_DIR} COMPONENT cxxabi - ) + LIBRARY DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi + RUNTIME DESTINATION ${LIBCXXABI_INSTALL_RUNTIME_DIR} COMPONENT cxxabi) endif() -if (NOT CMAKE_CONFIGURATION_TYPES AND LIBCXXABI_INSTALL_LIBRARY) +if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-cxxabi - DEPENDS cxxabi install-cxxabi-headers - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi - -P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake") + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxxabi) add_custom_target(install-cxxabi-stripped - DEPENDS cxxabi - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi - -DCMAKE_INSTALL_DO_STRIP=1 - -P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake") + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxxabi --strip) + + if (LIBCXXABI_INSTALL_LIBRARY) + add_dependencies(install-cxxabi cxxabi) + add_dependencies(install-cxxabi-stripped cxxabi) + endif() + + if(LIBCXXABI_INSTALL_HEADERS) + add_dependencies(install-cxxabi install-cxxabi-headers) + add_dependencies(install-cxxabi-stripped install-cxxabi-headers-stripped) + endif() endif() diff --git a/libunwind/include/CMakeLists.txt b/libunwind/include/CMakeLists.txt index 6796d67a3354f..eefd4305d06cc 100644 --- a/libunwind/include/CMakeLists.txt +++ b/libunwind/include/CMakeLists.txt @@ -21,12 +21,10 @@ if(LIBUNWIND_INSTALL_HEADERS) ) endforeach() - if(NOT CMAKE_CONFIGURATION_TYPES) + if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-unwind-headers DEPENDS unwind-headers - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind-headers - -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake") + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component unwind-headers) add_custom_target(install-unwind-headers-stripped DEPENDS install-unwind-headers) endif() endif() diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt index 514c2fcd5bf4e..6e947039fb0d5 100644 --- a/libunwind/src/CMakeLists.txt +++ b/libunwind/src/CMakeLists.txt @@ -159,13 +159,6 @@ set_target_properties(unwind_shared SOVERSION "1" ) -if (LIBUNWIND_ENABLE_SHARED) - list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared") -endif() -if (LIBUNWIND_INSTALL_SHARED_LIBRARY) - list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared") -endif() - # Build the static library. add_library(unwind_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS}) cxx_add_warning_flags(unwind_static_objects ${LIBUNWIND_ENABLE_WERROR} ${LIBUNWIND_ENABLE_PEDANTIC}) @@ -205,35 +198,40 @@ set_target_properties(unwind_static OUTPUT_NAME "${LIBUNWIND_STATIC_OUTPUT_NAME}" ) -if (LIBUNWIND_ENABLE_STATIC) - list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static") +# Add a meta-target for both libraries. +add_custom_target(unwind) +if (LIBUNWIND_ENABLE_SHARED) + add_dependencies(unwind unwind_shared) endif() -if (LIBUNWIND_INSTALL_STATIC_LIBRARY) - list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static") +if (LIBUNWIND_ENABLE_STATIC) + add_dependencies(unwind unwind_static) endif() -# Add a meta-target for both libraries. -add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS}) - -if (LIBUNWIND_INSTALL_LIBRARY) - install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} +if (LIBUNWIND_INSTALL_SHARED_LIBRARY) + install(TARGETS unwind_shared + ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind LIBRARY DESTINATION ${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind + RUNTIME DESTINATION ${LIBUNWIND_INSTALL_RUNTIME_DIR} COMPONENT unwind) +endif() + +if (LIBUNWIND_INSTALL_STATIC_LIBRARY) + install(TARGETS unwind_static ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind + LIBRARY DESTINATION ${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind RUNTIME DESTINATION ${LIBUNWIND_INSTALL_RUNTIME_DIR} COMPONENT unwind) endif() -if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY) +if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-unwind - DEPENDS unwind - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind - -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake") + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component unwind) add_custom_target(install-unwind-stripped - DEPENDS unwind - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind - -DCMAKE_INSTALL_DO_STRIP=1 - -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake") + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component unwind --strip) + + if (LIBUNWIND_INSTALL_LIBRARY) + add_dependencies(install-unwind unwind) + add_dependencies(install-unwind-stripped unwind) + endif() + if(LIBUNWIND_INSTALL_HEADERS) add_dependencies(install-unwind install-unwind-headers) add_dependencies(install-unwind-stripped install-unwind-headers-stripped) >From 496febaf031f9b2bd99447de66685364a8424dbc Mon Sep 17 00:00:00 2001 From: Louis Dionne <[email protected]> Date: Wed, 10 Dec 2025 13:51:55 -0500 Subject: [PATCH 2/3] TEMP: apply PR --- libcxx/test/CMakeLists.txt | 60 ++++++++------------------------- libcxxabi/test/CMakeLists.txt | 62 +++++++++-------------------------- 2 files changed, 28 insertions(+), 94 deletions(-) diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt index f4e577aed57de..8db36bcda944c 100644 --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -5,57 +5,23 @@ add_subdirectory(tools) # This ensures that we run the test suite against a setup that matches what we ship # in production as closely as possible (in terms of file paths, rpaths, etc). set(LIBCXX_TESTING_INSTALL_PREFIX "${LIBCXX_BINARY_DIR}/test-suite-install") +set(libcxx_test_suite_install_targets cxx-headers cxx cxx-modules) if (LIBCXX_CXX_ABI STREQUAL "libcxxabi") - add_custom_target(install-cxxabi-test-suite-prefix - DEPENDS cxxabi-headers - cxxabi - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXX_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") - add_dependencies(cxx-test-depends install-cxxabi-test-suite-prefix) + list(APPEND libcxx_test_suite_install_targets cxxabi-headers cxxabi) endif() - if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind) - add_custom_target(install-unwind-test-suite-prefix - DEPENDS unwind-headers - unwind - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXX_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") - add_dependencies(cxx-test-depends install-unwind-test-suite-prefix) + list(APPEND libcxx_test_suite_install_targets unwind-headers unwind) +endif() +foreach(target IN LISTS libcxx_test_suite_install_targets) + add_custom_target(libcxx-test-suite-install-${target} DEPENDS "${target}" + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" + --prefix "${LIBCXX_TESTING_INSTALL_PREFIX}" + --component "${target}") + add_dependencies(cxx-test-depends libcxx-test-suite-install-${target}) +endforeach() +if (TARGET cxx_experimental) + add_dependencies(libcxx-test-suite-install-cxx cxx_experimental) endif() - -add_custom_target(install-cxx-test-suite-prefix - DEPENDS cxx-headers - cxx - cxx_experimental - cxx-modules - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXX_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-modules - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx - -DCMAKE_INSTALL_PREFIX="${LIBCXX_TESTING_INSTALL_PREFIX}" - -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake") -add_dependencies(cxx-test-depends install-cxx-test-suite-prefix) set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!") set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n") diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt index 9eabfb08240b6..fadc818da2dc7 100644 --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -8,55 +8,23 @@ macro(pythonize_bool var) endif() endmacro() +# Install the library and its dependencies at a fake location so we can run the test +# suite against it. This ensures that we run the test suite against a setup that matches +# what we ship in production as closely as possible (in terms of file paths, rpaths, etc). set(LIBCXXABI_TESTING_INSTALL_PREFIX "${LIBCXXABI_BINARY_DIR}/test-suite-install") -add_custom_target(libcxxabi-install-cxx-for-testing - DEPENDS cxx-headers - cxx - cxx_experimental - cxx-modules - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-modules - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") -add_dependencies(cxxabi-test-depends libcxxabi-install-cxx-for-testing) - -add_custom_target(libcxxabi-install-cxxabi-for-testing - DEPENDS cxxabi-headers - cxxabi - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxxabi - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") -add_dependencies(cxxabi-test-depends libcxxabi-install-cxxabi-for-testing) - +set(libcxxabi_test_suite_install_targets cxx-headers cxx cxx-modules cxxabi-headers cxxabi) if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind) - add_custom_target(libcxxabi-install-unwind-for-testing - DEPENDS unwind-headers - unwind - COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind-headers - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=unwind - -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") - add_dependencies(cxxabi-test-depends libcxxabi-install-unwind-for-testing) + list(APPEND libcxxabi_test_suite_install_targets unwind-headers unwind) +endif() +foreach(target IN LISTS libcxxabi_test_suite_install_targets) + add_custom_target(libcxxabi-test-suite-install-${target} DEPENDS "${target}" + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" + --prefix "${LIBCXXABI_TESTING_INSTALL_PREFIX}" + --component "${target}") + add_dependencies(cxxabi-test-depends libcxxabi-test-suite-install-${target}) +endforeach() +if (TARGET cxx_experimental) + add_dependencies(libcxxabi-test-suite-install-cxx cxx_experimental) endif() pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER) >From 693ea8f14d3d63290294bda0bff51efb0ac9a0d8 Mon Sep 17 00:00:00 2001 From: Louis Dionne <[email protected]> Date: Wed, 10 Dec 2025 13:34:28 -0500 Subject: [PATCH 3/3] [runtimes] Remove dependencies on cxx_experimental for test-suite installs This patch removes explicit dependencies on cxx_experimental for installations that are local to the test suite. Such dependencies are not required anymore from the test-suite installation targets since the proper dependency is now encoded between cxx and cxx_experimental. --- libcxx/src/CMakeLists.txt | 7 ++----- libcxx/test/CMakeLists.txt | 3 --- libcxxabi/test/CMakeLists.txt | 3 --- libunwind/test/CMakeLists.txt | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index 03349fb38afa5..58ea2c825afe7 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -345,8 +345,8 @@ set_target_properties(cxx_experimental cxx_add_common_build_flags(cxx_experimental) target_compile_options(cxx_experimental PUBLIC -D_LIBCPP_ENABLE_EXPERIMENTAL) -# Add a meta-target for both libraries. -add_custom_target(cxx) +# Add a meta-target for both libraries and the experimental library. +add_custom_target(cxx DEPENDS cxx_experimental) if (LIBCXX_ENABLE_SHARED) add_dependencies(cxx cxx_shared) endif() @@ -389,9 +389,6 @@ if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-cxx-stripped COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component cxx --strip) - add_dependencies(install-cxx cxx_experimental) - add_dependencies(install-cxx-stripped cxx_experimental) - if (LIBCXX_INSTALL_LIBRARY) add_dependencies(install-cxx cxx) add_dependencies(install-cxx-stripped cxx) diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt index 8db36bcda944c..6294319815b42 100644 --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -19,9 +19,6 @@ foreach(target IN LISTS libcxx_test_suite_install_targets) --component "${target}") add_dependencies(cxx-test-depends libcxx-test-suite-install-${target}) endforeach() -if (TARGET cxx_experimental) - add_dependencies(libcxx-test-suite-install-cxx cxx_experimental) -endif() set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!") set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n") diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt index fadc818da2dc7..bc0902054a3be 100644 --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -23,9 +23,6 @@ foreach(target IN LISTS libcxxabi_test_suite_install_targets) --component "${target}") add_dependencies(cxxabi-test-depends libcxxabi-test-suite-install-${target}) endforeach() -if (TARGET cxx_experimental) - add_dependencies(libcxxabi-test-suite-install-cxx cxx_experimental) -endif() pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER) diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt index 42838218dac49..2559ab34f9d5b 100644 --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -15,7 +15,7 @@ endmacro() set(LIBUNWIND_TESTING_INSTALL_PREFIX "${LIBUNWIND_BINARY_DIR}/test-suite-install") set(libunwind_test_suite_install_targets unwind-headers unwind) if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES) - list(APPEND libunwind_test_suite_install_targets cxx-headers cxx cxx_experimental cxx-modules cxxabi-headers cxxabi) + list(APPEND libunwind_test_suite_install_targets cxx-headers cxx cxx-modules cxxabi-headers cxxabi) endif() foreach(target IN LISTS libunwind_test_suite_install_targets) add_custom_target(libunwind-test-suite-install-${target} DEPENDS "${target}" _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
