Skip to content
Snippets Groups Projects
DebugOptimization.cmake 750 B
Newer Older
  • Learn to ignore specific revisions
  • # DebugOptimization.cmake
    #
    
    # description: add debug optimization (gcc only)
    
    #
    # usage: from build directory
    #
    #        cmake .. -DCMAKE_BUILD_TYPE=Debug
    
    #        cmake --build . --config Debug --target coverage
    #
    # author: Jonathan Fisher
    #         j.fisher@fz-juelich.de, jonathan.m.fisher@gmail.com
    #
    # copyright: 2016 scientific computing group, Forshungszentrum Juelich GmbH
    #
    # license: see LICENSE
    #
    
    if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
    
      string(APPEND CMAKE_C_FLAGS " -Og")
    
    else()
      message(WARNING "C compiler is not GNU; debug optimization has no effect")
    endif()
    
    
      string(APPEND CMAKE_CXX_FLAGS " -Og")
    
    else()
      message(WARNING "C compiler is not GNU; debug optimization has no effect")
    endif()