[feature request] Way to define C macro across msvc and gcc like cmake
See original GitHub issuecmake has COMPILE_DEFINITIONS which used to set to a list of preprocessor definitions using the syntax VAR or VAR=value.
I know I could do the same thing with c_args: [ '-DFOO=bar' ] on gcc/clang or c_args: [ '/DFOO=bar' ] on msvc.
But I have to check compiler for each macro define site.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Define preprocessor macro through CMake? - Stack Overflow
If you are using CMake 3. X your first choice for adding a preprocessor macro should be target_compile_definitions. The reason you should ...
Read more >Configure and build with CMake Presets in Visual Studio
To build the entire project, select Build > Build All from the main menu. It's the same as running cmake --build --preset <buildPreset>...
Read more >cmake-toolchains(7) — CMake 3.25.1 Documentation
Introduction¶. CMake uses a toolchain of utilities to compile, link libraries and create archives, and other tasks to drive the build.
Read more >CMake Tutorial - Medium
.cmake files can be used as scripts, which runs cmake command to prepare environment pre-processing or split tasks which can be written outside...
Read more >Enabling C++11 And Later In CMake - Crascit -
The CXX_STANDARD target property mostly behaves as you would expect. It results in adding the relevant compiler and linker flags to the target ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Meson automatically converts UNIX style (gcc/clang) compiler options to the MSVC equivalent when required. You should always only put UNIX style flags into your
meson.buildand Meson will take care of the rest. Note that MSVC also understands the-DFOO=barsyntax without problems, so meson might not do anything in this instance.This already works as is, so, closing.