How to run a command at compile time within Makefile generated by CMake?

后端 未结 4 1473
面向向阳花
面向向阳花 2020-12-07 20:50

I would like to pass some options to a compiler. The option would have to be calculated at compile time - everytime when \'make\' is invoked, not when \'cmake\', so execute_

4条回答
  •  情话喂你
    2020-12-07 21:32

    Does this work?

    d=`perl -e"print qq(Whatever calculated at runtime);"`; g++ prog.cpp -o prog -DDATETIME=$$d
    

提交回复
热议问题