diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake --- a/llvm/cmake/modules/CrossCompile.cmake +++ b/llvm/cmake/modules/CrossCompile.cmake @@ -6,7 +6,7 @@ if(NOT DEFINED ${project_name}_${target_name}_BUILD) set(${project_name}_${target_name}_BUILD - "${CMAKE_BINARY_DIR}/${target_name}") + "${CMAKE_CURRENT_BINARY_DIR}/${target_name}") set(${project_name}_${target_name}_BUILD ${${project_name}_${target_name}_BUILD} PARENT_SCOPE) message(STATUS "Setting native build dir to " ${${project_name}_${target_name}_BUILD}) @@ -68,7 +68,7 @@ add_custom_command(OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_MAKE_PROGRAM="${CMAKE_MAKE_PROGRAM}" - ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} + ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_CURRENT_SOURCE_DIR} ${CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name}} -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}" @@ -99,17 +99,17 @@ cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN}) if(CMAKE_CONFIGURATION_TYPES) - set(output_path "${${CMAKE_PROJECT_NAME}_NATIVE_BUILD}/Release/bin/${target}") + set(output_path "${${PROJECT_NAME}_NATIVE_BUILD}/Release/bin/${target}") else() - set(output_path "${${CMAKE_PROJECT_NAME}_NATIVE_BUILD}/bin/${target}") + set(output_path "${${PROJECT_NAME}_NATIVE_BUILD}/bin/${target}") endif() - llvm_ExternalProject_BuildCmd(build_cmd ${target} ${${CMAKE_PROJECT_NAME}_NATIVE_BUILD} + llvm_ExternalProject_BuildCmd(build_cmd ${target} ${${PROJECT_NAME}_NATIVE_BUILD} CONFIGURATION Release) add_custom_command(OUTPUT "${output_path}" COMMAND ${build_cmd} - DEPENDS CONFIGURE_${CMAKE_PROJECT_NAME}_NATIVE ${ARG_DEPENDS} - WORKING_DIRECTORY "${${CMAKE_PROJECT_NAME}_NATIVE_BUILD}" + DEPENDS CONFIGURE_${PROJECT_NAME}_NATIVE ${ARG_DEPENDS} + WORKING_DIRECTORY "${${PROJECT_NAME}_NATIVE_BUILD}" COMMENT "Building native ${target}..." USES_TERMINAL) set(${output_path_var} "${output_path}" PARENT_SCOPE)