Add the "cmake.configureSettings" section to vs code's settings.json.
For remote development, using 'open remote settings' to open settings.json.
{
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "<vcpkg root folder>/scripts/buildsystems/vcpkg.cmake"
}
}
Add the following line to Qt Creator's CMake Configuration (Options->Kits-><kit>->CMake Configuration):
CMAKE_TOOLCHAIN_FILE:STRING=<vcpkg root folder>/scripts/buildsystems/vcpkg.cmake
QtCreator only looks for system-wide environment variables on Linux, the ones set in .bashrc or .bash_profile are valid only for the user.
To set a system-wide environment variable one can add it to /etc/environment, or to be more multi-user friendly one can set the variable in '/etc/profile` instead. This way the environment variable can contain another environment variable, like:
export QT5_CMAKE=$HOME/Qt5.13.1/5.13.1/gcc_64/lib/cmake/Qt5/
Append QT5's cmake path to CMAKE_PREFIX_PATH variable, for example:
list(APPEND CMAKE_PREFIX_PATH "~/Qt5.13.1/5.13.1/gcc_64/lib/cmake/Qt5/")
When adding envrionment variables to the remote host, you need to run "Kill VS Code Server on Host..."
command to take changes effect.
CMake sets certain variables to true depending on the current platform and toolchain in use. These always describe the target platform. In older versions of CMake, these were the only way of detecting the current platform.
- UNIX : is TRUE on all UNIX-like OS's, including Apple OS X and CygWin
- WIN32 : is TRUE on Windows. Prior to 2.8.4 this included CygWin
- APPLE : is TRUE on Apple systems. Note this does not imply the system is Mac OS X, only that APPLE is #defined in C/C++ header files.
- MINGW : is TRUE when using the MinGW compiler in Windows
- MSYS : is TRUE when using the MSYS developer environment in Windows
- CYGWIN : is TRUE on Windows when using the CygWin version of cmake