Building Advanced CMake for Linux Targets
In order to automatically edit CMakeLists.txt files in response to the changes made via Visual Studio GUI, VisualGDB requires CMake with Sysprogs Extensions or CMake 3.10 (not 3.10.1 or later).
The Sysprogs Extensions allow CMake to report detailed information about the location of each target, so VisualGDB can edit it.
The Sysprogs Extensions were merged into CMake 3.10, removed from 3.10.1 and replaced with another similar interface in CMake 3.14. In order to use Advanced CMake projects on Linux targets, please consider the following options:
- Build CMake with Sysprogs extensions (see instructions below). This will also enable stepping through CMake files and more precise editing of settings.
- Install original CMake 3.10 (not 3.10.1).
- Install original CMake 3.14 or later.
The Sysprogs fork of CMake is 100% backwards-compatible with the original CMake. All features added in it improve the IDE integration and do not change any other logic. If you use our CMake fork for development, you will be always able to build your projects using the original CMake and get exactly the same results.
If you are building your projects on Windows, VisualGDB will automatically install and use the advanced CMake build. If you are building your code on Linux, follow the steps below to download the modified source code and build it:
- Ensure the git client is installed on your Linux machine. You can normally install it via “sudo apt-get install git” or “yum install git”.
- Run the following commands:
git clone https://github.com/sysprogs/CMake.git cd CMake mkdir build && cd build ../configure make sudo make install
- If CMake build fails due to unsupported make_unique<>, try updating your gcc to version 4.9 or later, or simply modify cmServer.cxx as shown below:
-debug = std::make_unique<DebugInfo>(); +debug.reset(new DebugInfo);
then modify cmServerProtocol.cxx:
-this->m_CMakeInstance = std::make_unique<cmake>(); +this->m_CMakeInstance.reset(new cmake);
- f CMake complains about missing dependencies, install them using apt-get or yum. On Debian-based systems you can run “sudo apt-get build-dep cmake” to get the packages neceesary to build CMake.
- Once the new CMake is installed, ensure it is executed when you run the ‘cmake’ command (you can check this by running ‘which cmake’). Alternatively you can specify the location of the new CMake binary via VisualGDB Project Properties.
If you are building the code on Windows, VisualGDB will automatically download the pre-built version of our CMake fork. If you don’t have direct Internet connection on that computer, please download it here and specify its location via Tools->Options->VisualGDB->Common->Tools->Full Path to CMake.exe.