llvm.org GIT mirror llvm / 9b89282
[cmake] Pass TARGETS_TO_BUILD through to host tools build In r319620, the host build was changed to use Native for TARGETS_TO_BUILD because passing semicolons through add_custom_command is surprisingly difficult. However, Native really doesn't make any sense here, and it only works because we don't technically do any codegen in the host tools so pretty well anything will "work". The problem here is that passing something other than the correct value is very fragile - as evidence note how the llvm-config in the host tools acts differently than the target one now, and misreports the targets to build. Similarly, if there is any logic conditional on the targets in tablegen (now or in the future), it will do the wrong thing. To fix this, we need to escape the semicolons in the targets string and pass it through to the child cmake invocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320413 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 1 year, 10 months ago
1 changed file(s) with 6 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3535 add_custom_target(CREATE_LLVM_${target_name}
3636 DEPENDS ${LLVM_${target_name}_BUILD})
3737
38 # Escape semicolons in the targets list so that cmake doesn't expand
39 # them to spaces.
40 string(REPLACE ";" "$" targets_to_build_arg
41 "${LLVM_TARGETS_TO_BUILD}")
42
3843 add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
3944 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
4045 ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
4146 -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
42 -DLLVM_TARGETS_TO_BUILD=Native
47 -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}"
4348 ${build_type_flags} ${linker_flag} ${external_clang_dir}
4449 WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
4550 DEPENDS CREATE_LLVM_${target_name}