Two same output obj generated by VS IDE and CMake command line cause LNK4006

I’m adding NASM files into projects by CMakelists. With this version, IDE and project have two output folders to generate same obj, so that cause warning lnk4006 already defined second definition ignored. One output folder and it is like build\encoder\x86.
Another is like build\encoder\x86\xxxenc_x86_asm.dir\Debug\ or build\encoder\x86\xxxenc_x86_asm.dir\Release.

I have trid to update the second output path to be same with the first, but it can’t work.
(if hardcode $(IntDir) inside VS to be build\encoder\x86 , it can work, but it doesn’t make sence)

CMakelists like following:

add_library(${ENCODER_X86_ASM_LIB_NAME} OBJECT "")

if ((LINUX OR MACOSX OR WIN32) AND ${ENABLE_ASM})
  set(ASM_EXECUTABLE "${NASM_EXE}")

  if(CMAKE_GENERATOR STREQUAL "Xcode")
    add_library(${ENCODER_NATIVE_ASM_LIB_NAME} INTERFACE)
  endif()
     
  set(X86_ASM_SRCS
      asm/avx2/average_avx2.asm)

  if (WIN32)
    set(ASM_FLAGS ...)
  elseif(MACOSX)
    set(ASM_FLAGS -I${PROJECT_SOURCE_DIR}/ -f macho64 -O2 -DARCH_X86_64=1 -DPREFIX -DOS_MAC=1 -DPIC -Worphan-labels -DSTACK_ALIGNMENT=16)
  elseif(LINUX)
    set(ASM_FLAGS -I${PROJECT_SOURCE_DIR}/ -f elf64 -O2 -DARCH_X86_64=1 -DOS_MAC=0 -DPIC -Worphan-labels -DSTACK_ALIGNMENT=16)
  endif()

  #generate objects when building CMake

  if(CMAKE_GENERATOR STREQUAL "Xcode")
    asm_compile_to_target(${ENCODER_NATIVE_ASM_LIB_NAME} ${X86_ASM_SRCS})
  else()
    asm_compile_to_target(${ENCODER_X86_ASM_LIB_NAME} ${X86_ASM_SRCS})
  endif()

  if ((MACOSX AND (CMAKE_GENERATOR STREQUAL "Xcode")) OR WIN32)
    foreach(asm_file ${X86_ASM_SRCS})
      set(ASM_SRC ${CMAKE_CURRENT_LIST_DIR}/${asm_file})
      get_filename_component(filename "${asm_file}" NAME_WE)
      set(ASM_OBJ "${CMAKE_CURRENT_BINARY_DIR}/${filename}${CMAKE_C_OUTPUT_EXTENSION}") 
      list(APPEND ASM_SRCS ${ASM_SRC})
      list(APPEND ASM_OBJS ${ASM_OBJ})
      add_custom_command(
        OUTPUT ${ASM_OBJ}
        COMMAND ${ASM_EXECUTABLE}
        ARGS ${ASM_FLAGS}  ${ASM_SRC} -o ${ASM_OBJ}
        DEPENDS ${ASM_SRC}
      )
    endforeach()
  
    foreach(OBJ ${ASM_OBJS})
      list(APPEND ASM_PRIMITIVES ${OBJ})
    endforeach()
  
    foreach(SRC ${X86_ASM_SRCS})
      list(APPEND ASM_PRIMITIVES ${CMAKE_CURRENT_LIST_DIR}/${SRC})
    endforeach()
  
    source_group(Assembly FILES ${ASM_PRIMITIVES})
  
    if(CMAKE_GENERATOR STREQUAL "Xcode")
      target_sources(${ENCODER_NATIVE_ASM_LIB_NAME} INTERFACE ${ASM_PRIMITIVES})
    else()
      target_sources(${ENCODER_X86_ASM_LIB_NAME} PRIVATE ${ASM_PRIMITIVES})
    endif()
  
    if (MACOSX)
      add_custom_target(${ENCODER_X86_ASM_LIB_NAME}-asm ALL DEPENDS ${ASM_PRIMITIVES})
      target_sources(${ENCODER_X86_ASM_LIB_NAME} INTERFACE ${ASM_PRIMITIVES})
      add_dependencies(${ENCODER_X86_ASM_LIB_NAME} ${ENCODER_X86_ASM_LIB_NAME}-asm)
    else()
      target_sources(${ENCODER_X86_ASM_LIB_NAME} PRIVATE ${ASM_PRIMITIVES})
    endif()
  endif() ## if ((MACOSX) AND (CMAKE_GENERATOR STREQUAL "Xcode") OR WIN32)
endif() ## if ((LINUX OR MACOSX OR WIN32) AND ${ENABLE_AVX2})

target_compile_definitions(${ENCODER_X86_ASM_LIB_NAME} PUBLIC)

Here, CMAKE_CURRENT_BINARY_DIR is one output folder and it is build\encoder\x86. how to deal with this issue? Background is this: we need to support incremental compiling in IDE, also need to support building by cmake command line.

I have tried to update output path(or directory) as:

set_target_properties(${ENCODER_X86_ASM_LIB_NAME} PROPERTIES LIBRARY_OUTPUT_PATH ${PATH} )
set_target_properties(${ENCODER_X86_ASM_LIB_NAME} PROPERTIES BUILD_RPATH ${PATH} )
set_target_properties(${ENCODER_X86_ASM_LIB_NAME} PROPERTIES INSTALL_RPATH ${PATH} )
set_target_properties(${ENCODER_X86_ASM_LIB_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PATH} )  

It just can’t work.

Thanks!