In a C++ file, I have a code like this:
#if ACTIVATE
# pragma message( \"Activated\" )
#else
# pragma message( \"Not Activated\")
#endif
I
Maybe it is a bad idea to answer such old question, but recently I googled a similar problem and found this topic. I wrote a cmd script for some build system and I was succeed to find a solution. I leave it here for future generations (:
According to @acemtp's problem, my solution would look like this:
@echo off
:: it is considered that Visual Studio tools are in the PATH
if "%1"=="USE_ACTIVATE_MACRO" (
:: if parameter USE_ACTIVATE_MACRO is passed to script
:: the macro ACTIVATE will be defined for the project
set CL=/DACTIVATE#1
)
call msbuild /t:Rebuild /p:Configuration=Release
UPD: I tried to use set CL=/DACTIVATE=1
and it also worked, but the official documentation recommends to use number sign