How to remove quotation marks in the final command output?

So I need to remove the quotation marks from the commands, I don’t see how though… Please help.

The error:

FAILED: CMakeFiles/ccov-clean
cmd.exe /C "cd /D ...\build\test && "del \f ...\build\test\ccov\binaries.list"  && "del \f ...\build\test\ccov\profraw.list" "
The filename, directory name, or volume label syntax is incorrect.

The relevant CMake code:

add_custom_target(
  ccov-clean
  COMMAND 
    "$<$<PLATFORM_ID:Windows>:del /f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list>"
    "$<$<PLATFORM_ID:Linux, Darwin>:rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list>"
  COMMAND 
    "$<$<PLATFORM_ID:Windows>:del /f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list>"
    "$<$<PLATFORM_ID:Linux, Darwin>:rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list>"
)

What if you replace the spaces with ; instead? Or better would be to use "${CMAKE_COMMAND}" -E rm -f "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list" "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list" so you don’t need it to be platform-dependent.

1 Like

Oh I didn’t know about ${CMAKE_COMMAND} making it platform-independent. Thanks Ben!