Extract cxxflags method from cflags method

This commit is contained in:
Jack Nagel 2013-11-10 18:24:49 -06:00
parent 7e2979707c
commit 43baf49ff1

View File

@ -91,10 +91,14 @@ class Cmd
args << "-syslibroot" << $sdkroot args << "-syslibroot" << $sdkroot
end if nclt? end if nclt?
allflags = case mode allflags = case mode
when :ccld, :cxxld when :ccld
cflags + args + cppflags + ldflags cflags + args + cppflags + ldflags
when :cc, :cxx when :cxxld
cxxflags + args + cppflags + ldflags
when :cc
cflags + args + cppflags cflags + args + cppflags
when :cxx
cxxflags + args + cppflags
when :ccE when :ccE
args + cppflags args + cppflags
when :cpp when :cpp
@ -158,11 +162,6 @@ class Cmd
end end
def cflags def cflags
args = [] args = []
if mode == :cxx
args << '-std=c++11' if cccfg? 'x'
args << '-stdlib=libc++' if cccfg? 'g'
args << '-stdlib=libstdc++' if cccfg? 'h'
end
return args unless cccfg? 'O' return args unless cccfg? 'O'
@ -188,6 +187,13 @@ class Cmd
args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/ args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/
args args
end end
def cxxflags
args = cflags
args << '-std=c++11' if cccfg? 'x'
args << '-stdlib=libc++' if cccfg? 'g'
args << '-stdlib=libstdc++' if cccfg? 'h'
args
end
def syslibpath def syslibpath
# We reject brew's lib as we explicitly add this as a -L flag, thus it # We reject brew's lib as we explicitly add this as a -L flag, thus it
# is given higher priority by cc, so it surpasses the system libpath. # is given higher priority by cc, so it surpasses the system libpath.