cmake: Generate compile flags more robustly by stotko · Pull Request #128 · stotko/stdgpu (original) (raw)
The current behavior of applying compiler flags is to append them to CMAKE_<LANG>_FLAGS which may not be robust. Furthermore, the respective files, i.e. set_host_flags.cmake and set_device_flags.cmake, directly apply the modification. Instead, the modern way to add compiler flags is through target_compile_options(...).
Refactor the compile flag generation process by separating the set of flags into distinct functions and improve the compiler detection via CMAKE_<LANG>_COMPILER_ID. This results in a better grouping of flags across the backends and a cleaner handling of the generated flags across different compilers.