xref: /aosp_15_r20/external/pdfium/build_overrides/compiler/BUILD.gn (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1# Copyright 2022 The PDFium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# A simplified config to consistently use C++17 and override the config
6# in //build/config/compiler, which is using C++20 by default on many platforms.
7
8assert(!is_nacl)
9
10config("force_cxx17") {
11  cflags_cc = []
12
13  if (is_linux || is_chromeos || is_android || current_os == "aix") {
14    if (is_clang) {
15      standard_prefix = "c"
16    } else {
17      standard_prefix = "gnu"
18    }
19    cflags_cc += [ "-std=${standard_prefix}++17" ]
20  } else if (is_win) {
21    cflags_cc += [ "/std:c++17" ]
22  } else {
23    cflags_cc += [ "-std=c++17" ]
24  }
25}
26