diff --git a/meson.build b/meson.build index 028e4c70b9..a8a5ae2990 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ -project('freeciv', ['c', 'cpp'], meson_version: '>= 0.57.0') +project('freeciv', ['c'], meson_version: '>= 0.57.0') if not get_option('ack_experimental') error('Autotools are still the only fully supported way to build freeciv.\nSet configure option "ack_experimental" to true if you really want to do experimental meson build.\n' + @@ -7,7 +7,16 @@ if not get_option('ack_experimental') endif c_compiler = meson.get_compiler('c') -cxx_compiler = meson.get_compiler('cpp') + +if get_option('ruledit') or \ + get_option('clients').contains('qt') or \ + get_option('fcmp').contains('qt') + add_languages('cpp', native: false) + cxx_build = true + cxx_compiler = meson.get_compiler('cpp') +else + cxx_build = false +endif if c_compiler.has_argument('-Wno-nonnull-compare') add_global_arguments('-Wno-nonnull-compare', language : 'c') @@ -143,9 +152,7 @@ if host_system == 'windows' add_global_arguments('-D_WIN32_WINNT=' + min_win_ver, language: ['c', 'cpp']) endif - if get_option('ruledit') or \ - get_option('clients').contains('qt') or \ - get_option('fcmp').contains('qt') + if cxx_build if get_option('debug') # Qt flags have malformed macro definition triggering this error # Also C compiler affected as the macro is on its commandline too @@ -673,7 +680,7 @@ if crosser pub_conf_data.set('FREECIV_CROSSER', 1) endif -if cxx_compiler.compiles(''' +if cxx_build and cxx_compiler.compiles(''' class me { void top(); }; void me::top() { [=, this]() {}; };