Since CMake 3.12 this has been superseded by add_compile_definitions and
other commands.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/docs/CMake.rst also mentions add_definitions:
include_directories(${LLVM_INCLUDE_DIRS}) separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS}) add_definitions(${LLVM_DEFINITIONS_LIST})
I'm not sure what this should be changed to. @sepavloff do you know?
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
71 | I wonder if remove_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:NDEBUG>) works? |
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
71 | Interesting. I did not know about remove_definitions. But I'd prefer not to do that in this patch, since I have already tested it as-is. |
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
71 | Generator expressions may be a bit convoluted to read, but I think it is better to use add_compile_options with a conditional generator expression than to add the option, then need to remove it from places where it shouldn't be. I think the code as written is preferable and easier to maintain in the long run. |
I wonder if remove_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:NDEBUG>) works?
It seems it is able to remove previously added DDEBUG from the command line, but otherwise does not pass "-UNDEBUG" to the compiler.