Index: cmake/modules/CrossCompile.cmake =================================================================== --- cmake/modules/CrossCompile.cmake +++ cmake/modules/CrossCompile.cmake @@ -6,9 +6,12 @@ message(STATUS "Setting native build dir to " ${LLVM_${target_name}_BUILD}) endif(NOT DEFINED LLVM_${target_name}_BUILD) + if (buildtype) + set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") + endif() + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) - set(CROSS_TOOLCHAIN_FLAGS_${target_name} - -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\" + set(CROSS_TOOLCHAIN_FLAGS_${target_name} -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\" CACHE STRING "Toolchain file for ${target_name}") endif() @@ -17,7 +20,7 @@ COMMENT "Creating ${LLVM_${target_name}_BUILD}...") add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + COMMAND ${CMAKE_COMMAND} ${build_type_flags} -G "${CMAKE_GENERATOR}" ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} DEPENDS ${LLVM_${target_name}_BUILD} @@ -29,23 +32,6 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LLVM_${target_name}_BUILD}) - if(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD}) - - - message(STATUS "Configuring ${target_name} build...") - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${LLVM_${target_name}_BUILD} ) - - message(STATUS "Configuring ${target_name} targets...") - if (buildtype) - set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") - endif() - execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags} - -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} - ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} - WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} ) - endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD}) - endfunction() function(llvm_create_cross_target target_name sysroot)