[llvm-dev] "-stdlib=libc++" applied to CMAKE_CXX_FLAGS

259 views
Skip to first unread message

Brian Cain via llvm-dev

unread,
Nov 17, 2016, 6:09:44 PM11/17/16
to llvm-dev

llvm/cmake/modules/HandleLLVMStdlib.cmake specifies “-stdlib=libc++” for CMAKE_CXX_FLAGS when LLVM_ENABLE_LIBCXX and CXX_SUPPORTS_STDLIB.  From what I can see this is a flag intended for the linker and not the compiler.

 

I’d like to submit a change to delete CMAKE_CXX_FLAGS from this append() but I wanted to check in with the list to see if that makes sense or if there are other contexts for which “stdlib=libc++” might be used.

 

If I specify “-nostdinc++”, “-stdlib=libc++” doesn’t get consumed and clang emits a warning.

 

$ clang++ -nostdinc++ -stdlib=libc++ -o main.o -c main.cpp

clang-4.0: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]

 

Brian Cain via llvm-dev

unread,
Nov 18, 2016, 1:50:12 PM11/18/16
to Jordan Rose, llvm-dev

Jordan,

 

Waaay back in 2014 you added “append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_CXX_FLAGS)” to HandleLLVMStdlib.cmake and I’m asking if it might’ve been in error.  I’ll submit a review to delete the CMAKE_CXX_FLAGS unless you think it still makes sense.

 

-Brian

Jordan Rose via llvm-dev

unread,
Nov 18, 2016, 1:59:32 PM11/18/16
to Brian Cain, llvm-dev
Doesn't this control search paths as well? It's only because you're specifying -nostdinc++ that it's going unused for you.

Jordan

Brian Cain via llvm-dev

unread,
Nov 18, 2016, 2:22:57 PM11/18/16
to jorda...@apple.com, llvm-dev

Hmm, so it does: HSOpts.UseLibcxx.  My mistake.

 

-Brian

Reply all
Reply to author
Forward
0 new messages