question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature request] Way to define C macro across msvc and gcc like cmake

See original GitHub issue

cmake 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:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mensindacommented, Oct 17, 2020

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.build and Meson will take care of the rest. Note that MSVC also understands the -DFOO=bar syntax without problems, so meson might not do anything in this instance.

0reactions
eli-schwartzcommented, Oct 4, 2022

This already works as is, so, closing.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found