llvm.org GIT mirror llvm / c2fa8e7
[CMake] Use variables rather than ":" delimiters This is a more idiomatic CMake. Differential Revision: https://reviews.llvm.org/D37644 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335703 91177308-0d34-0410-b5e6-96231b3b80d8 Petr Hosek 1 year, 2 months ago
2 changed file(s) with 20 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
230230
231231 # Add top-level targets
232232 foreach(target ${ARG_EXTRA_TARGETS})
233 string(REPLACE ":" ";" target_list ${target})
234 list(GET target_list 0 target)
235 list(LENGTH target_list target_list_len)
236 if(${target_list_len} GREATER 1)
237 list(GET target_list 1 target_name)
233 if(DEFINED ${target})
234 set(external_target "${${target}}")
238235 else()
239 set(target_name "${target}")
240 endif()
241 llvm_ExternalProject_BuildCmd(build_runtime_cmd ${target} ${BINARY_DIR})
242 add_custom_target(${target_name}
236 set(external_target "${target}")
237 endif()
238 llvm_ExternalProject_BuildCmd(build_runtime_cmd ${external_target} ${BINARY_DIR})
239 add_custom_target(${target}
243240 COMMAND ${build_runtime_cmd}
244241 DEPENDS ${name}-configure
245242 WORKING_DIRECTORY ${BINARY_DIR}
401401 endif()
402402
403403 foreach(runtime_name ${runtime_names})
404 list(APPEND ${name}_extra_targets
405 "${runtime_name}:${runtime_name}-${name}"
406 "install-${runtime_name}:install-${runtime_name}-${name}"
407 "install-${runtime_name}-stripped:install-${runtime_name}-${name}-stripped")
404 set(${runtime_name}-${name} ${runtime_name})
405 set(install-${runtime_name}-${name} install-${runtime_name})
406 set(install-${runtime_name}-${name}-stripped install-${runtime_name}-stripped)
407 list(APPEND ${name}_extra_targets ${runtime_name}-${name} install-${runtime_name}-${name} install-${runtime_name}-${name}-stripped)
408408 if(LLVM_INCLUDE_TESTS)
409 list(APPEND ${name}_test_targets "check-${runtime_name}:check-${runtime_name}-${name}")
409 set(check-${runtime_name}-${name} check-${runtime_name} )
410 list(APPEND ${name}_test_targets check-${runtime_name}-${name})
410411 endif()
411412 endforeach()
412413
413414 foreach(target_name IN LISTS SUB_COMPONENTS SUB_INSTALL_TARGETS)
414 list(APPEND ${name}_extra_targets "${target_name}:${target_name}-${name}")
415 set(${target_name}-${name} ${target_name})
416 list(APPEND ${name}_extra_targets ${target_name}-${name})
415417 endforeach()
416418
417419 foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
423425 endforeach()
424426
425427 if(LLVM_INCLUDE_TESTS)
426 list(APPEND ${name}_test_targets
427 "runtimes-test-depends:runtimes-test-depends-${name}"
428 "check-runtimes:check-runtimes-${name}")
428 set(runtimes-test-depends-${name} runtimes-test-depends)
429 set(check-runtimes-${name} check-runtimes)
430 list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
429431 foreach(target_name IN LISTS SUB_CHECK_TARGETS)
430 list(APPEND ${name}_test_targets "${target_name}:${target_name}-${name}")
431 list(APPEND test_targets "${target_name}-${name}")
432 set(${target_name}-${name} ${target_name})
433 list(APPEND ${name}_test_targets ${target_name}-${name})
434 list(APPEND test_targets ${target_name}-${name})
432435 endforeach()
433436 set(test_targets "${test_targets}" PARENT_SCOPE)
434437 endif()