Skip to content

Warning flags cause errors when building with Clang using the MSVC frontend #177

@Muppetsg2

Description

@Muppetsg2

The title pretty much says it all.
When I tried to build cppast using the clang compiler with the msvc frontend, I got an error about incorrectly defined compiler flags. I did some reading, and if anyone is still having problems, I recommend changing lines 118 to 126 of the src/CMakeLists.txt file to:

target_compile_options(cppast PRIVATE
    # MSVC/clang with MSVC frontend warnings
    $<$<OR:$<CXX_COMPILER_ID:MSVC>,$<AND:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_FRONTEND_VARIANT:MSVC>>>:
    /W3>
    # GCC/clang with GNU frontend warnings
    $<$<OR:$<CXX_COMPILER_ID:GNU>,$<AND:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_FRONTEND_VARIANT:GNU>>>:
    -pedantic-errors -Werror -Wall -Wextra -Wconversion -Wsign-conversion>
    # disable noexcept type warning on GCC
    $<$<CXX_COMPILER_ID:GNU>:
    -Wno-noexcept-type>
)

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