In CMake for my project I have the following:
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("Using GCC compiler")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message("Using Clang compiler")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Using MSVC compiler")
add_compile_options(
/MP # MULTIPROCESSOR COMPILE
/Oi # ENABLE COMPILER INTRINSICS
/utf-8
$<$<CONFIG:DEBUG>:/fsanitize=address /fsanitize=fuzzer>
)
else ()
message("Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif ()
It generates fine, but in Visual Studio when I try to compile it gives the error:
Error C1083 Cannot open source file: ‘$<1:/fsanitize=address’: No such
file or directory MyProject F:$<1:fsanitize=address 1
It’s specifically that generator expression line that causes this. Why is this making the compiler look for a source file? Is the MyProject F:$<1:fsanitize=address 1 a clue?