CMake is a popular cross-platform build system and build tool generator that is widely used in Linux environments. It allows developers to write build scripts in a high-level, platform-independent language and generates build files that can be used with various build tools, such as make, Ninja, and Visual Studio.
Here are some key concepts and commands related to CMake in Linux:
- CMakeLists.txt: This is the main configuration file for CMake. It contains information about the project, such as the source files, dependencies, and build options.
- cmake: This is the command-line tool used to configure and generate build files based on the CMakeLists.txt file. For example, running cmake . in the project directory will generate the build files in the current directory.
- make: This is a build tool that can be used to build the project after the CMake build files have been generated. Running make in the project directory will compile the source code and create the binary executable.
- cmake-gui: This is a graphical user interface tool that can be used to configure CMake projects. It allows you to set project options and generate build files without using the command line.
- CMAKE_BUILD_TYPE: This is a CMake variable that specifies the type of build to generate, such as Debug or Release.
- CMAKE_INSTALL_PREFIX: This is a CMake variable that specifies the installation directory for the built project.
- add_executable: This is a CMake command that adds an executable target to the project. It takes the name of the target and a list of source files as arguments.
- add_library: This is a CMake command that adds a library target to the project. It takes the name of the target and a list of source files as arguments.
- target_link_libraries: This is a CMake command that links a library target to an executable target. It takes the name of the executable target and the name of the library target as arguments.
Uninstall cmake Package in Ubuntu
You can uninstall cmake package from Ubuntu using the below command:
$ sudo apt-get remove cmake
Uninstall cmake including dependent package
If you would like to remove cmake and it’s dependent packages which are no longer needed from Ubuntu:
$ sudo apt-get remove --auto-remove cmake
Use Purging cmake
If you use with purge options to cmake package all the configuration and dependent packages will be removed.
$ sudo apt-get purge cmake
If you use purge options along with auto remove, will be removed everything regarding the package, It’s really useful when you want to reinstall again.
$ sudo apt-get purge --auto-remove cmake