When I am invoking CMake from the Powershell, it behaves differently then when calling from cmd.
Mainly, it doesn’t parse any files specified by -DCMAKE_TOOLCHAIN_FILE=...
.
When e.g. I run
cmake .. -DCMAKE_TOOLCHAIN_FILE=..\my_toolchain.cmake
from cmd, the toolchain file is read, but when I am running from powershell, the toolchain file is not processed at all.
I am well aware that this might be a powershell thing, how powershell passes arguments and such. But it has already cost me various hours of my life, so my question is: is this a bug, or am I doing things wrong? any other options i pass with -DSOME_OPTION=ON
are processed just fine from both cmd and powershell.
Any help is highly appreciated!
# CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(toolchain_test)
option(TEST_VAR "my option" OFF)
message(STATUS "Test variable ${TEST_VAR}")
and
#my_toolchain.cmake
set(TEST_VAR ON)