I am writing CMake for my project. It works fine, but every time when I want to use it, I have to specify some additional parameters:
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="D:/stm32-cmake/cmake/gcc_stm32.cmake" -DSTM32_CHIP=STM32F207ZCT ..
Is it possible to save these parameters in CMakeLists.txt file? In my CMakeLists.txt I tried following options:
set(STM32_CHIP STM32F207ZCT)
set(STM32_CHIP STM32F207ZCT CACHE STRING "")
add_definitions(-DSTM32_CHIP=STM32F207ZCT)
But none of these seems to work. These parameters are used in toolchain file, so probably I have to set these variables globally in some way. And is it possibile to set CMAKE_TOOLCHAIN_FILE in CMakeLists.txt? This code:
set(CMAKE_TOOLCHAIN_FILE "D:/stm32-cmake/cmake/gcc_stm32.cmake")
is not working.