From 4f4061d6005699b8d0b5c4ed3a5395087b249792 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Wed, 27 Jun 2018 03:14:41 +0000 Subject: [PATCH] [CMake] Use variables rather than ":" delimiters This is a more idiomatic CMake. Differential Revision: https://reviews.llvm.org/D37644 llvm-svn: 335703 --- cmake/modules/LLVMExternalProjectUtils.cmake | 13 ++++------ runtimes/CMakeLists.txt | 25 +++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cmake/modules/LLVMExternalProjectUtils.cmake b/cmake/modules/LLVMExternalProjectUtils.cmake index f491f39e1b0..bc6ac9f4569 100644 --- a/cmake/modules/LLVMExternalProjectUtils.cmake +++ b/cmake/modules/LLVMExternalProjectUtils.cmake @@ -231,16 +231,13 @@ function(llvm_ExternalProject_Add name source_dir) # Add top-level targets foreach(target ${ARG_EXTRA_TARGETS}) - string(REPLACE ":" ";" target_list ${target}) - list(GET target_list 0 target) - list(LENGTH target_list target_list_len) - if(${target_list_len} GREATER 1) - list(GET target_list 1 target_name) + if(DEFINED ${target}) + set(external_target "${${target}}") else() - set(target_name "${target}") + set(external_target "${target}") endif() - llvm_ExternalProject_BuildCmd(build_runtime_cmd ${target} ${BINARY_DIR}) - add_custom_target(${target_name} + llvm_ExternalProject_BuildCmd(build_runtime_cmd ${external_target} ${BINARY_DIR}) + add_custom_target(${target} COMMAND ${build_runtime_cmd} DEPENDS ${name}-configure WORKING_DIRECTORY ${BINARY_DIR} diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 40694451b17..35e17a2f6a5 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -402,17 +402,19 @@ else() # if this is included from LLVM's CMake endif() foreach(runtime_name ${runtime_names}) - list(APPEND ${name}_extra_targets - "${runtime_name}:${runtime_name}-${name}" - "install-${runtime_name}:install-${runtime_name}-${name}" - "install-${runtime_name}-stripped:install-${runtime_name}-${name}-stripped") + set(${runtime_name}-${name} ${runtime_name}) + set(install-${runtime_name}-${name} install-${runtime_name}) + set(install-${runtime_name}-${name}-stripped install-${runtime_name}-stripped) + list(APPEND ${name}_extra_targets ${runtime_name}-${name} install-${runtime_name}-${name} install-${runtime_name}-${name}-stripped) if(LLVM_INCLUDE_TESTS) - list(APPEND ${name}_test_targets "check-${runtime_name}:check-${runtime_name}-${name}") + set(check-${runtime_name}-${name} check-${runtime_name} ) + list(APPEND ${name}_test_targets check-${runtime_name}-${name}) endif() endforeach() foreach(target_name IN LISTS SUB_COMPONENTS SUB_INSTALL_TARGETS) - list(APPEND ${name}_extra_targets "${target_name}:${target_name}-${name}") + set(${target_name}-${name} ${target_name}) + list(APPEND ${name}_extra_targets ${target_name}-${name}) endforeach() foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS}) @@ -424,12 +426,13 @@ else() # if this is included from LLVM's CMake endforeach() if(LLVM_INCLUDE_TESTS) - list(APPEND ${name}_test_targets - "runtimes-test-depends:runtimes-test-depends-${name}" - "check-runtimes:check-runtimes-${name}") + set(runtimes-test-depends-${name} runtimes-test-depends) + set(check-runtimes-${name} check-runtimes) + list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name}) foreach(target_name IN LISTS SUB_CHECK_TARGETS) - list(APPEND ${name}_test_targets "${target_name}:${target_name}-${name}") - list(APPEND test_targets "${target_name}-${name}") + set(${target_name}-${name} ${target_name}) + list(APPEND ${name}_test_targets ${target_name}-${name}) + list(APPEND test_targets ${target_name}-${name}) endforeach() set(test_targets "${test_targets}" PARENT_SCOPE) endif()