From: Alex Bradbury Date: Wed, 13 Dec 2017 09:02:13 +0000 (+0000) Subject: [cmake] Fix host tools build in when LLVM_EXPERIMENTAL_TARGETS_TO_BUILD is set X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93b8ba08eb2d75830781b81933c3ca2a79cdde6e;p=llvm [cmake] Fix host tools build in when LLVM_EXPERIMENTAL_TARGETS_TO_BUILD is set r320413 triggered cmake configure failures when building with -DLLVM_OPTIMIZED_TABLEGEN=True and with LLVM_EXPERIMENTAL_TARGETS_TO_BUILD set (e.g. to RISCV). This is because that patch moved to passing through LLVM_TARGETS_TO_BUILD, and at that point LLVM_EXPERIMENTAL_TARGETS_TO_BUILD has been merged in to it. LLVM_EXPERIMENTAL_TARGETS_TO_BUILD must be also be passed through to avoid errors like below: -- Constructing LLVMBuild project information CMake Error at CMakeLists.txt:682 (message): The target `RISCV' does not exist. It should be one of AArch64;AMDGPU;ARM;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;Sparc;SystemZ;X86;XCore -- Configuring incomplete, errors occurred! See the thread http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171211/509225.html for discussion of this fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320556 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/CrossCompile.cmake b/cmake/modules/CrossCompile.cmake index 117eda77878..0ec76ead5c4 100644 --- a/cmake/modules/CrossCompile.cmake +++ b/cmake/modules/CrossCompile.cmake @@ -40,12 +40,15 @@ function(llvm_create_cross_target_internal target_name toolchain buildtype) # them to spaces. string(REPLACE ";" "$" targets_to_build_arg "${LLVM_TARGETS_TO_BUILD}") + string(REPLACE ";" "$" experimental_targets_to_build_arg + "${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}") add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}" + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${experimental_targets_to_build_arg}" ${build_type_flags} ${linker_flag} ${external_clang_dir} WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} DEPENDS CREATE_LLVM_${target_name}