I want to write a cmake file that sets different compiler options for clang++, g++ and MSVC in debug and release builds. What I\'m doing currently looks something like this:
Another way is to use .rsp files.
set(rsp_file "${CMAKE_CURRENT_BINARY_DIR}/my.rsp") configure_file(my.rsp.in ${rsp_file} @ONLY) target_compile_options(mytarget PUBLIC "@${rsp_file}")
which might make the inclusion of multiple and esoteric options easier to manage.