I’ve been looking into installing my code into different directories depending upon the configuration type. This is for Visual Studios – multi-config compiler.
I’ve done this by setting
CMAKE_INSTALL_PATH=<path>/\${BUILD_TYPE}
I found conflicting results depending upon how I triggered the install.
If the install is triggered from Visual Studio by seleting the “INSTALL” target and building from there, it works.
If the install is triggered from the command line with the command
cmake --build Build/build64/VS2022 --config "Release" --target install
It also works.
However, if the install is triggered from the command line with the comand
cmake --install Build/build64/VS2022 --config "Release"
It doesn’t work.
I added some message() statements to the generated cmake_isntall.cmake
file and I learned the BUILD_TYPE variable isn’t set for the cmake --install
scenario.
Is this a known defect? Or is this on purpose? If on purpose why would it behave differently from the --target install
variant?
I’m using cmake version 3.23.1