Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using -Werror on OSX causes compilation error #48

Open
Fohlen opened this issue Mar 6, 2019 · 3 comments · May be fixed by #60 or #62
Open

Using -Werror on OSX causes compilation error #48

Fohlen opened this issue Mar 6, 2019 · 3 comments · May be fixed by #60 or #62

Comments

@Fohlen
Copy link

Fohlen commented Mar 6, 2019

Please see the following log, https://travis-ci.org/inexorgame/entity-system/jobs/502307832#L1700

This is caused by -Wunused and should not cause a linker error. The idiomatic C++17 way to solve this is using maybe_unused.

Currently

set(WARNINGS "-Werror" "-Wall")
prevents us from building crossguid (commit b151b7d) as mentioned in #47

A suggested quick fix is disabling -Werror (which isn't amazing anyways, see this post), but we would hope to be able to switch back to crossguid/master as soon as possible, with unused functions being marked as such.

@Fohlen
Copy link
Author

Fohlen commented Mar 6, 2019

Post scriptum: If -Werror is removed, the build runs through, as seen here: https://travis-ci.org/inexorgame/entity-system/jobs/502578790

@cmaughan
Copy link

I get this too.

vcpkg/buildtrees/crossguid/src/365d430337-f320045b03.clean/src/guid.cpp:403:7: error: unused function 'swap' [-Werror,-Wunused-function]
void swap(xg::Guid &lhs, xg::Guid &rhs)

@TheLartians TheLartians linked a pull request Jan 26, 2021 that will close this issue
@oliviervibe
Copy link

The -Werror option should be removed from the CMakeLists.txt or a way to disable it in case. An unused function warning should never be treated as an error! (swap function causing the build to fail!)
Replace in CMakeLists.txt with those lines.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNINGS "-Wall")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WARNINGS "-Wall")
elseif(MSVC)
set(WARNINGS "/WX" "/W4")
endif()

Currently, it makes it impossible to include this project using FetchContent_Declare(crossguid GIT_REPOSITORY https://github.com/graeme-hill/crossguid.git) when compiling for anything else than Windows (unfortunately other systems exist :-))
The only remaining way is to get a copy of the code without pulling it from Git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants