I want to use cmake on my project but I have to define a preprocessor macro this way :
#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
The problem is that the file compile with this : 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
How do I specify those options in cmake (-DCONFIG_TEXTUI)?
this is my actual CMakeLists.txt :
cmake_minimum_required(VERSION 3.15)
project(morpion C)
set(CMAKE_C_STANDARD 99)
add_executable(morpion main.c game.c board.c player_manager_mock.c board_view_text.c tictactoe_erros.c test_checkEndOfGame.c)
set_property(GLOBAL PROPERTY DCONFIG_TEXTUI)
set_property(GLOBAL PROPERTY DCONFIG_PLAYER_MANAGER_MOCK)