Crippin
Crippin

Reputation: 165

clang: warning: argument unused during compilation: '-stdlib=libc++'

I cannot find much information regarding this. What can cause clang to specify this warning?

I have a dev machine which runs a cmake script and everything works fine. The very same cmake file is being executed on a build server the above message is being printed out all the time.

The build server is running clang3.8 while my dev machine is running clang4. I cannot reproduce this problem with a simple solution either. For instance, a simple main.cpp will not cause this error:

clang++ main.cpp -std=c++14 -stdlib=libc++

works just fine even on the build machine.

Any ideas why this might get printed?

This are the flags im using:

set(LIBRARY_RELEASE_OPTIONS "-Wall;-Wextra;-pedantic;-Wlong-long;-Wmissing-braces;-Wunused-function;-Wuninitialized;-Wunused-label;-Wunused-parameter;-Wdisabled-optimization;-O2;-std=c++14;")
add_library(${SHARED_LIBRARY_NAME} STATIC ${SERVER_SOURCE})                                             
target_compile_options(${SHARED_LIBRARY_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${LIBRARY_RELEASE_OPTIONS}>")

Upvotes: 6

Views: 11244

Answers (2)

Cinder Biscuits
Cinder Biscuits

Reputation: 5259

If you want to silence the warning, add -Wno-error=unused-command-line-argument to the LIBRARY_RELEASE_OPTIONS this is required to quell the warning with ccache, distcc, etc.

Also, it's best to use set(CMAKE_CXX_STANDARD 14) rather than adding -std=c++14; to LIBRARY_RELEASE_OPTIONS

Upvotes: -1

Crippin
Crippin

Reputation: 165

The problem seemed to be related to ccache. ccache 3.3.3 works as expected while 3.2.4 on ubuntu 16 LTS seems to cause this warning.

Upvotes: 1

Related Questions