我想在我的项目上使用cmake,但是我必须以这种方式定义一个预处理器宏:
#if defined CONFIG_TEXTUI
void BoardView_init (void)
{
}
void BoardView_free (void)
{
}
void BoardView_displayAll (void)
{
}
void BoardView_displaySquare (Coordinate x,Coordinate y,PieceType kindOfPiece)
{
BoardView_displayAll();
}
void BoardView_displayEndOfGame (GameResult result)
{
// TODO: à compléter
}
void BoardView_displayPlayersTurn (PieceType thisPlayer)
{
// TODO: à compléter
}
void BoardView_sayCannotPutPiece (void)
{
// TODO: à compléter
}
#endif // defined CONFIG_TEXTUI
问题在于文件使用以下命令编译:{{1}}
如何在cmake(-DCONFIG_TEXTUI)中指定这些选项?
这是我实际的CMakeLists.txt:
gcc -std=c99 -DCONFIG_TEXTUI -DCONFIG_PLAYER_MANAGER_MOCK -o etape1 main.c board.c game.c board_view_text.c tictactoe_erros.c player_manager_mock.c