meson: Only require C++ if tests are enabled

C++ is only required for the tests as they are implemented using gtest.
Don't require a C++ compiler if the tests are disabled.

Change-Id: I660aed484139d6d7d547ce774b5843a272eff9af
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index b21ad58..f9c943b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('libpldm', ['c','cpp'],
+project('libpldm', 'c',
     default_options: [
       'debug=true',
       'optimization=g',
@@ -13,6 +13,10 @@
     meson_version: '>=1.1.0',
 )
 
+if get_option('tests').allowed()
+  add_languages('cpp')
+endif
+
 add_project_arguments('-D_DEFAULT_SOURCE', language: ['c'])
 
 compiler = meson.get_compiler('c')