AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Cmake if windows10/17/2023 ![]() ![]() Once finished, enter the build folder ( cd build) and run the make command (if this command does not exist, it is because you did not rename the MinGW file to that name as mentioned in the article about MinGW cited above, then most likely the command will be mingw32-make).To make CMake find the libraries, it is often needed to set up the CMAKEPREFIXPATH environment variable so it points to the directories where dependencies of your project are installed. The output will be similar to the image below: I wont give you exact step-by-step howto, since I use Arch Linux but I used it in Windows 7 too. If you don’t say -G "Unix Makefiles" it will prepare files for Visual Studio, in which case we want a Unix-like Makefile. It will create a folder called build inside your project. Also create a main.cpp file with a basic code, example:Īuto main ( int argc, char ** argv ) -> int Īt the end your MyProject folder will have 2 files: CMakeLists.txt and main.cpp as shown in the image below:.If the output is similar to the image below, everything is right and installed perfectly:Ĭreate a folder, for example MyProject, enter it (by CMD or PowerShell, cd MyProject) and inside it do:Ĭreate a file named CMakeLists.txt with your Preferred Code Editor or IDE and fill it with the code below:Ĭmake_minimum_required (VERSION 3.10 ) project (HelloWorld ) add_executable (hello main.cpp ) Open PowerShell or CMD and type the command: cmake -version Hint: Keep what already appears and click Next.Ĭlick on Install and wait for the installation to finish. Download CMake by clicking the button below:Īfter downloading, double-click on the downloaded file: cmake-3.26.0-rc6-windows-x86_64.msi and give administrator permissions to start the installation setup.Ĭheck the Add CMake to the system PATH for all users option for the command to be available to all system users. Today we will see how to install CMake on Windows.Īs in this example we will use GCC, it is important that you have it installed on your Windows via MinGW, see here how to do it. ![]() We already made a brief introduction here on the blog about CMake, but it is also possible to generate Makefiles in Windows, although CMake also generates files for Visual Studio. On Unix type systems we can say that it is a “ Makefile” generator. CMake is a system to automate compilation tasks of code files created in C and C++. ![]()
0 Comments
Read More
Leave a Reply. |