Move c(pp) language standard definitions outside Xcode functions
end
- function xcode.XCBuildConfiguration_CLanguageStandard(settings, cfg)
- -- if no cppdialect is provided, don't set C dialect
- -- projects without C dialect set will use compiler default
- if not cfg.cdialect then
- return
- end
-
- local cLanguageStandards = {
+ xcode.cLanguageStandards = {
["Default"] = "compiler-default", -- explicit compiler default
["C89"] = "c89",
["C90"] = "c90",
["gnu11"] = "gnu11"
}
- local cLanguageStandard = cLanguageStandards[cfg.cdialect]
+ function xcode.XCBuildConfiguration_CLanguageStandard(settings, cfg)
+ -- if no cppdialect is provided, don't set C dialect
+ -- projects without C dialect set will use compiler default
+ if not cfg.cdialect then
+ return
+ end
+
+ local cLanguageStandard = xcode.cLanguageStandards[cfg.cdialect]
if cLanguageStandard then
settings['GCC_C_LANGUAGE_STANDARD'] = cLanguageStandard
end
end
- function xcode.XCBuildConfiguration_CppLanguageStandard(settings, cfg)
- -- if no cppdialect is provided, don't set C++ dialect
- -- projects without C++ dialect set will use compiler default
- if not cfg.cppdialect then
- return
- end
-
- local cppLanguageStandards = {
+ xcode.cppLanguageStandards = {
["Default"] = "compiler-default", -- explicit compiler default
["C++98"] = "c++98",
["C++11"] = "c++0x", -- Xcode project GUI uses c++0x, but c++11 also works
["C++14"] = "c++14",
["C++17"] = "c++1z",
["gnu++98"] = "gnu++98",
- ["gnu++11"] = "gnu++0x", -- Xcode project GUI uses gnu++0x, but c++11 also works
+ ["gnu++11"] = "gnu++0x", -- Xcode project GUI uses gnu++0x, but gnu++11 also works
["gnu++14"] = "gnu++14",
["gnu++17"] = "gnu++1z"
}
- local cppLanguageStandard = cppLanguageStandards[cfg.cppdialect]
+ function xcode.XCBuildConfiguration_CppLanguageStandard(settings, cfg)
+ -- if no cppdialect is provided, don't set C++ dialect
+ -- projects without C++ dialect set will use compiler default
+ if not cfg.cppdialect then
+ return
+ end
+
+ local cppLanguageStandard = xcode.cppLanguageStandards[cfg.cppdialect]
if cppLanguageStandard then
settings['CLANG_CXX_LANGUAGE_STANDARD'] = cppLanguageStandard
end
