llvm.org GIT mirror llvm / 8ad3e86
[cmake] Revert (rL319574): Resubmit Remove redundant call to cmake when building host tools. Still fails for some bots. Differential Revision: https://reviews.llvm.org/D40229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319582 91177308-0d34-0410-b5e6-96231b3b80d8 Don Hinton 1 year, 10 months ago
1 changed file(s) with 28 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
1111 CACHE STRING "Toolchain file for ${target_name}")
1212 endif()
1313
14 if (buildtype)
15 set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}")
16 endif()
17 if (LLVM_USE_LINKER AND NOT CMAKE_CROSSCOMPILING)
18 set(linker_flag "-DLLVM_USE_LINKER=${LLVM_USE_LINKER}")
19 endif()
20 if (LLVM_EXTERNAL_CLANG_SOURCE_DIR)
21 # Propagate LLVM_EXTERNAL_CLANG_SOURCE_DIR so that clang-tblgen can be built
22 set(external_clang_dir "-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=${LLVM_EXTERNAL_CLANG_SOURCE_DIR}")
23 endif()
24
2514 add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}
2615 COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_${target_name}_BUILD}
2716 COMMENT "Creating ${LLVM_${target_name}_BUILD}...")
3322 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
3423 ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
3524 -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
36 -DLLVM_TARGETS_TO_BUILD=Native
37 ${build_type_flags} ${linker_flag} ${external_clang_dir}
3825 WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
3926 DEPENDS CREATE_LLVM_${target_name}
4027 COMMENT "Configuring ${target_name} LLVM...")
4128
4229 add_custom_target(CONFIGURE_LLVM_${target_name}
4330 DEPENDS ${LLVM_${target_name}_BUILD}/CMakeCache.txt)
31
32 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
33 ${LLVM_${target_name}_BUILD})
34
35 if(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})
36
37 message(STATUS "Configuring ${target_name} build...")
38 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
39 ${LLVM_${target_name}_BUILD} )
40
41 message(STATUS "Configuring ${target_name} targets...")
42 if (buildtype)
43 set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}")
44 endif()
45 if (LLVM_USE_LINKER AND NOT CMAKE_CROSSCOMPILING)
46 set(linker_flag "-DLLVM_USE_LINKER=${LLVM_USE_LINKER}")
47 endif()
48 if (LLVM_EXTERNAL_CLANG_SOURCE_DIR)
49 # Propagate LLVM_EXTERNAL_CLANG_SOURCE_DIR so that clang-tblgen can be built
50 set(external_clang_dir "-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=${LLVM_EXTERNAL_CLANG_SOURCE_DIR}")
51 endif()
52 execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags}
53 -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
54 ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
55 -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
56 ${external_clang_dir} ${linker_flag}
57 WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} )
58 endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})
4459
4560 endfunction()
4661