title: Meson compiling subprojects in debug mode
body: <p>I have a parent project and a subproject using meson. Quite sadly the subproject only builds in release mode. However, even if I set the parent project to debug using --reconfigure and check with configure that the build type is debug, it seems the NDEBUG macro is not defined for the subproject, which causes it to fail compilation.</p>
  <p>Is there a way to enable debug builds for subprojects?</p>
  <p>Parent snippet:</p>
  <pre><code>project(
      'SdfParametrization',
      'cpp',
      version: '0.0.1',
      license: 'GPL',
      default_options : [
          'cpp_std=c++20',
          'default_library=static',
          'optimization=3',
          'b_ndebug=true'])
  
  add_global_arguments(
      '-DVULKAN_HPP_NO_EXCEPTIONS',
      '-DVULKAN_HPP_TYPESAFE_CONVERSION',
      '-DNDEBUG',
      '-Wno-unused-function',
      '-fdiagnostics-color=always',
      '--coverage',
      language : 'cpp')
  
  add_global_link_arguments(
      '-lgcov',
      '-lubsan',
      '-ldl',
      '-lvulkan',
      language : 'cpp')
  
  cpp = meson.get_compiler('cpp')
  
  neverengine_proj = subproject('neverengine', default_options:['buildtype=debugoptimized'])
  neverengine_dep = neverengine_proj.get_variable('core_never_engine_dep')
  
  executable('sdf_parameterization', 'ray_tracing.cpp', dependencies:[neverengine_dep])
  </code></pre>
  <p>Child snippet:</p>
  <pre><code>project(
      'NeverEngine',
      'cpp',
      version: '0.0.1',
      license: 'GPL',
      default_options : [
          'cpp_std=c++20',
          'default_library=static',
          'optimization=3'])
  
  if not meson.is_subproject()
      add_global_arguments(
          '-DVULKAN_HPP_NO_EXCEPTIONS',
          '-DVULKAN_HPP_TYPESAFE_CONVERSION',
          '-Wno-unused-function',
          '-fdiagnostics-color=always',
          '-fsanitize=undefined',
          '--coverage',
          language : 'cpp')
  
      add_global_link_arguments(
          '-lgcov',
          '-lubsan',
          language : 'cpp')
  endif
  
  cpp = meson.get_compiler('cpp')
  
  external_include_dirs = [
      'libraries/Eigen/',
      'libraries/imgui/',
      'libraries/incbin/']
  
  sources = files(
      'Src/Engine/Animation/Animation.cpp',
      'Src/Engine/Animation/AnimationMesh.cpp',
      'Src/Engine/Animation/GltfLib.cpp',
      'Src/Engine/Animation/GltfLoaders.cpp',
      'Src/Engine/Animation/Image/CpuImage.cpp',
      'Src/Engine/Animation/NumericIntegration.cpp',
      'Src/Engine/Animation/SpringMass.cpp',
      'Src/Engine/DataSanitation/AttributeInputSanitation.cpp',
      'Src/Engine/DynamicLoading/DynamicLoader.cpp',
      'Src/Engine/EmbeddedShaders/EmbeddedShaders.cpp',
      'Src/Engine/GUI/Guizmo3D.cpp',
      'Src/Engine/GUI/_imgui.cpp',
      'Src/Engine/GUI/imgui_bridge.cpp',
      'Src/Engine/Geometry/DualContouring.cpp',
      'Src/Engine/Geometry/GeometryUtils.cpp',
      'Src/Engine/Geometry/HMesh.cpp',
      'Src/Engine/Geometry/HeatGeodesics.cpp',
      'Src/Engine/Geometry/MatrixMesh.cpp',
      'Src/Engine/Geometry/MeshGradient.cpp',
      'Src/Engine/Geometry/MeshUtils.cpp',
      'Src/Engine/Geometry/Parametrics.cpp',
      'Src/Engine/Geometry/SdfFramework.cpp',
      'Src/Engine/Geometry/Subdivision.cpp',
      'Src/Engine/Helpers/EigenHelpers.cpp',
      'Src/Engine/Helpers/FlotingPointArithmetic.cpp',
      'Src/Engine/Helpers/MiscUtils.cpp',
      'Src/Engine/Helpers/NumberTheory.cpp',
      'Src/Engine/Helpers/VectorManipulation.cpp',
      'Src/Engine/Helpers/log.cpp',
      'Src/Engine/Noise/Noise.cpp',
      'Src/Engine/Renderer/Camera/Camera.cpp',
      'Src/Engine/Renderer/IO/GLFW_tools.cpp',
      'Src/Engine/Renderer/IO/InputHandler.cpp',
      'Src/Engine/Renderer/IO/Window.cpp',
      'Src/Engine/Renderer/Renderer.cpp',
      'Src/Engine/Renderer/Rendering/Effects.cpp',
      'Src/Engine/Renderer/Rendering/Gallery.cpp',
      'Src/Engine/Renderer/Rendering/RenderTargetStorage.cpp',
      'Src/Engine/Renderer/Rendering/RenderingTechniques.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/HardwareInterface.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/Image.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/Memory.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/RenderTarget.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/RenderingPipeline.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/ShaderProgram.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/Utils.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/VkExtensionsStubs.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/VulkanBuffer.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/VulkanDebugging.cpp',
      'Src/Engine/Renderer/Scribe/Scribe.cpp',
      'Src/Engine/Shared/Shared.cpp')
  
  external_incs = include_directories(external_include_dirs, is_system : true)
  internal_incs = include_directories(['Src/Engine/', 'build/'])
  
  all_includes = []
  all_includes += external_incs
  all_includes += internal_incs
  
  pkg = import('pkgconfig')
  
  linked_dependencies = []
  
  linked_dependencies += dependency('vulkan', include_type : 'system')
  linked_dependencies += dependency('vulkan-memory-allocator', include_type : 'system')
  linked_dependencies += dependency('glfw3', include_type : 'system')
  linked_dependencies += dependency('threads', include_type : 'system')
  linked_dependencies += dependency('zlib', include_type : 'system')
  linked_dependencies += dependency('shaderc_static', include_type : 'system')
  linked_dependencies += dependency('freetype2', include_type : 'system')
  linked_dependencies += dependency('stb', include_type : 'system')
  linked_dependencies += dependency('tinygltf', include_type : 'system')
  
  pre_target = custom_target(
      'Preprocess',
      output : [
          'UniformObjects.cpp',
          'UniformObjects.hpp'],
          build_always_stale : true,
          command : ['python3', '../Scripts/preprocessing.py'])
  
  sources += pre_target
  core_lib = library('CoreNeverEngine',
      sources,
      include_directories : all_includes,
      dependencies : linked_dependencies,
      build_by_default : true)
  pkg.generate(core_lib)
  
  example_path_template = 'Src/examples/@0@/@1@.cpp'
  
  examples = [
      'base_example',
      'disk_terrain',
      'example2',
      'gaussian_subdivision',
      'gltf_loading',
      'heat_geodesics',
      'implicit_functions',
      'mesh_matrices',
      'ray_tracing',
      'sponza_scene',
      'spring_mass',
      'terrain_generation']
  
  foreach example : examples
      tokens = example.split('_')
      camel_case_name = ''
      foreach word : tokens
          lower_case = word[0]
          upper_case = lower_case.to_upper()
          camel_case_name += upper_case + word
          camel_case_name = camel_case_name.replace(upper_case + lower_case, upper_case)
      endforeach
  
      path = example_path_template.format(camel_case_name, example)
      target = executable(camel_case_name, [path],
          include_directories : all_includes,
          link_with : core_lib,
          dependencies : [linked_dependencies])
  
  endforeach
  
  linked_dependencies += dependency('gtest')
  
  geometry_test_files = [
      'Src/Engine/Geometry/tests/GeometryTests.cpp',
      'Src/Engine/Geometry/tests/TestsGeometryUtils_hpp.cpp',
  
      'Src/Engine/Geometry/GeometryUtils.cpp',
      'Src/Engine/Helpers/log.cpp',
  ]
  test = executable(
      'GeometryTests',
      geometry_test_files,
      include_directories : all_includes,
      dependencies : linked_dependencies,
      link_args : ['-fprofile-arcs', '-ftest-coverage'],
      cpp_args : ['-fprofile-arcs', '-ftest-coverage'])
  
  test('GeometryTests', test)
  
  
  vulkan_test_files = [
      'Src/Engine/Renderer/Rendering/VulkanLayer/tests/VulkanLayerTests.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/tests/TestsHardwareInterface_cpp.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/tests/TestsHardwareInterface_hpp.cpp',
  
      'Src/Engine/Renderer/Rendering/VulkanLayer/VulkanDebugging.cpp',
      'Src/Engine/Renderer/Rendering/VulkanLayer/VkExtensionsStubs.cpp',
      'Src/Engine/Helpers/log.cpp',
  ]
  test = executable(
      'VulkanTests',
      vulkan_test_files,
      include_directories : all_includes,
      dependencies : linked_dependencies,
      link_args : ['-fprofile-arcs', '-ftest-coverage'],
      cpp_args : ['-fprofile-arcs', '-ftest-coverage'])
  
  test('VulkanTests', test)
  </code></pre>