I need to define a precompiler element(pragma? macro? not sure how you call them) as DEBUG in a cmake project loaded with VS
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "main.exe (bin\\main.exe)",
"name": "main.exe (bin\\main.exe)",
"pragmas": [
"DEBUG":"true"
]
}
]
}
so it can be used in the code as
#ifdef DEBUG
#if DEBUG
is it possible ?
thanks for your help
launch.vs.jsoncontains all the settings to help Visual Studio understand how to launch your already compiled executable.What you're looking for is a place that gives the compiler (not the launcher) the instructions how to create the executable (depending upon the preprocessor directives).
Different ways of doing this, depending on your project type.
If it's a native VS project (
.slnsolution, just for clearance): right click on your Project, click onProperties, then move toC/C++ / Preprocessorand fill inPreprocessor definitionsfield.If you're writing a CMake project, you can use the command
add_compile_definitionsin yourCMakeLists.txtlist file.