Skip to content

DEBUG and ASSERT should be derived from CMAKE_BUILD_TYPE #55

@Krzmbrzl

Description

@Krzmbrzl

The use of a separate option DEBUG that controls optimization flags conflicts with standard CMake build type configuration (CMAKE_BUILD_TYPE=Debug). That is, even if I tell CMake to create a Debug build, GKLib will still use -O3, which breaks debuggability. It is worth noting that CMake will add -O3 for Release builds by itself without any need for projects to do this manually.

In analogy, having a baked-in option ASSERT that defines the NDEBUG macro leads to build results contrary to the user's expectation. CMake will set this macro in accordance with the build type. If you want to decoupled control over assertions, a separate macro (and assert functions) should be used (as is done with NDEBUG2).

Related: KarypisLab/METIS#116

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions