Cpp Compiler flags not accessible in the swift for Cpp-Swift Interop

I have a project that has Cpp code and swift code and I m making some calls from swift to cpp. For this I m using the Cpp-swift interop mechanism introduced in swift 5.9 for making direct calls between swift and cpp.

I m using module.modulemap file to expose the cpp code to swift. I am facing an error when I try to access a cpp header that are using the cpp compiler flags in some static assert statements. These methods are working fine in cpp however, when I try to access these methods from swift by importing the module in modulemap file, the compiler flags are not being identified by swift, and produces the below error

error: use of undeclared identifier 'TW_KERNEL_WINDOWS'.

This is my module.modulemap file:

module CoreModule {
   header  "ProcessStates.hpp"  //cpp header that contains compiler flags 
    export *

below is the cpp header code that I m trying to access in swift:

#pragma once

// if the given condition is false – treat as an error
#define     STATIC_CHECKFALSE(condition, message)            static_assert (condition, message)


Can someone help, why is this happening and how to resolve this?

I m setting these preprocessor compillation flags in the cmake file using add_compile_definitions command. These flags are appearing in the Swift Compiler custom flags(under Active Compilation Conditions), But the swift is producing an error as above.