Now let's use our Makefile by simply typing in Cygwin:Ī new message should appear in your terminal: │ │ ├── CMakeDetermineCompilerABI_CXX.binĪll those files aren't useful for us, they are used by CMake. #endif // !_BADPROG_H Generating the Makefileīut it comes with many other different files, below the complete list: Only the constructor to have a really easy example. Straightforward file, it prints a string from the code.Ĭout << "Hello from Badprog and CMake! :D" << endl It's of course possible to add more than 1 file for this second parameter, but here we have only 1 file. It takes 2 arguments, the first is the name of the executable and the second is the name of source files needed to generate this executable. The add_executable() command is to generate the project executable file. With the cmake_minimum_required command, we tell CMake to generate an error if the CMake version is lower than the one required (3.6 in our case). This file is a simple text file with the following code.Īdd_executable(BadprogTutorial Badprog.cpp) So we have these 3 files now in C:\dev\cmake\tutorial: To start our CMake tutorial, we need 3 files that we have to create ourselves: We will use the following directory as main directory for our tutorial: Indeed the cmake command (from Cygwin) calls the cmake.exe file within the following directory:Īnd not the one you've downloaded on the official website.Īnyway, if you want to know which version you are using, type the following command in your favorite CLI:įrom the Cygwin terminal, you should see something like this:ĬMake suite maintained and supported by Kitware (/cmake). So no need to download it from the official website.īe careful though if you installed CMake as an independant program because with Cygwin you won't use the one downloaded from the official website. If you don't know what to install, just follow this Cygwin tutorial (Part 1 and 2).ĬMake is already included inside the packages you downloaded if you followed this Cygwin tutorial. We will install it in the following directory: Our main CLI for this tutorial will be Cygwin: That's why CMake has been created, it works on every operating system (the first letter " C" standing for Cross-platform).įurthermore, with CMake it will be possible to generate Visual Studio project files, like. To be honest the main reason is because in the Windows world there is no native GNU tools available. So why creating a new tool as the GNU one works well? Thus it reduces our mechanism to only 2 steps.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |