• Tachi's avatar
    Modernize CMakeLists.txt · 6cd4d7f2
    Tachi authored
    WIth this I'm trying to fix some of the issues pointed out in #827.
    
    Changes:
    
    Use add_compile_options() instead of modifying CMAKE_CXX_FLAGS.
    
    Use -Og instead of -O0
    (from https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html :
    [-Og] is a better choice than -O0 for producing debuggable code because
    some compiler passes that collect debug information are disabled at -O0)
    
    Fix LTO check (previously it would fail because it checked only
    CMAKE_CXX_FLAGS. This didn't work when properly enabling LTO
    through CMAKE_INTERPROCEDURAL_OPTIMIZATION).
    I'm not sure if I modified it correctly since I don't really understand
    what that check is trying to do in the first place.
    
    Check for Clang or GCC when applying compiler specific flags.
    
    This changes require CMake 3.9 or higher, but I don't think this will
    cause any issues.
    6cd4d7f2
CMakeLists.txt 7.24 KB