Posting my answer for anyone else who comes across this problem.
#compile with optimizations on
target_compile_options(Executable PRIVATE -O3 -g)
#this will convert the passed file to assembly
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/assembly.s
COMMAND ${CMAKE_CXX_COMPILER}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/foo.cpp -O3 -S -o ${CMAKE_CURRENT_SOURCE_DIR}/assembly.s
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/foo.cpp
COMMENT "Generating The Assembly File"
VERBATIM
)
#this will convert the assembly analysis
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/analysis.txt
COMMAND llvm-mca
ARGS -mcpu=btver2 -timeline ${CMAKE_CURRENT_SOURCE_DIR}/assembly.s -o ${CMAKE_CURRENT_SOURCE_DIR}/analysis.txt
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/assembly.s
COMMENT "Running LLVM MCA"
VERBATIM
)
add_custom_target(run ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/assembly.s ${CMAKE_CURRENT_SOURCE_DIR}/analysis.txt)
Probably worth mentioning that I am by no means an expert, however LLVM MCA seems to be used for analysing a single file at a time. This means that a simple command (such as I pasted above when asking the question) is realistically sufficient.
Also an error 'error: no assembly instructions found'. Means optimizations probably removed all code between the START and END macros (happened to me when I made a simple program for testing).