How to pass preprocessor definition to llvm build

Hi,

I am using #ifdef MACRO_A in my llvm source code (in compiler-rt .c file). Wondering how to enable it in the llvm build command?

Currently I am using the following cmake command to build compiler-rt. How do I enable MACRO_A flag in the build command?

cmake -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES=compiler-rt -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_ASSERTIONS=On ../llvm

Thanks!

do the good-old CMAKE_CXX_FLAGS / CMAKE_C_FLAGS work?

Thank you Hsu.

But I finally ended up adding this line in the CMakeLists.txt of compiler-rt and this should work I guess.

add_definitions(-DMACRO_A)