[lld] Revise IDE folder structure (#89747)

Update the folder titles for targets in the monorepository that have not
seen taken care of for some time. These are the folders that targets are
organized in Visual Studio and XCode
(`set_property(TARGET <target> PROPERTY FOLDER "<title>")`)
when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically
deduce the folder. This reduces the number of
`set_property`/`set_target_property`, but are still necessary when
`add_custom_target`, `add_executable`, `add_library`, etc. are used. A
LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's
root CMakeLists.txt.
This commit is contained in:
Michael Kruse 2024-06-04 01:31:36 +02:00 committed by GitHub
parent ccaccc3367
commit 30e983c40c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 7 deletions

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.20.0)
set(LLVM_SUBPROJECT_TITLE "LLD")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@ -192,6 +193,7 @@ add_subdirectory(tools/lld)
if (LLVM_INCLUDE_TESTS)
add_custom_target(LLDUnitTests)
set_target_properties(LLDUnitTests PROPERTIES FOLDER "LLD/Tests")
if (TARGET llvm_gtest)
add_subdirectory(unittests)
endif()

View File

@ -11,7 +11,6 @@ macro(add_lld_library name)
set(ARG_ENABLE_SHARED SHARED)
endif()
llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
get_target_export_arg(${name} LLD export_to_lldtargets)
@ -33,7 +32,6 @@ endmacro(add_lld_library)
macro(add_lld_executable name)
add_llvm_executable(${name} ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "lld executables")
endmacro(add_lld_executable)
macro(add_lld_tool name)

View File

@ -83,10 +83,9 @@ add_lit_testsuite(check-lld "Running lld test suite"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${LLD_TEST_DEPS}
)
set_target_properties(check-lld PROPERTIES FOLDER "lld tests")
add_custom_target(lld-test-depends DEPENDS ${LLD_TEST_DEPS})
set_target_properties(lld-test-depends PROPERTIES FOLDER "lld tests")
set_target_properties(lld-test-depends PROPERTIES FOLDER "LLD/Tests")
add_lit_testsuites(LLD ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${LLD_TEST_DEPS}
@ -95,4 +94,4 @@ add_lit_testsuites(LLD ${CMAKE_CURRENT_SOURCE_DIR}
# Add a legacy target spelling: lld-test
add_custom_target(lld-test)
add_dependencies(lld-test check-lld)
set_target_properties(lld-test PROPERTIES FOLDER "lld tests")
set_target_properties(lld-test PROPERTIES FOLDER "LLD/Tests")

View File

@ -1,5 +1,3 @@
set_target_properties(LLDUnitTests PROPERTIES FOLDER "lld tests")
function(add_lld_unittests test_dirname)
add_unittest(LLDUnitTests ${test_dirname} ${ARGN})
endfunction()