CMake is a platform-independent build system to compile C/C++ code. To link Gurobi into your project you can extend this template. It consists of a FindGUROBI.cmake to determine the necessary include and linker commands and a CMakeLists.txt that specifies how your code needs to be built.
How to build a C/C++ project on Windows
cmake -H. -Bbuild
cmake --build build --config Release [Debug]
How to build a C/C++ project on Linux/macOS
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release [Debug]
cmake --build build
To build a pure C project, you can specify -DCXX=off in the first step.
These commands will create a new subdirectory named build where the compiled files can be found. On Windows, the resulting executable is located in build\Release\.
Note: This template uses mip1_c++.cpp from the Gurobi C++ examples directory.