To create folder build
PS> cmake -B build/ -S . -G "MinGW Makefiles"
To compile
PS> cmake --build build/
To create hidden folder git
PS> git init
To show git the files in which we want to see changes we need to create file .gitignore and whire there:
PS> *.swp
PS> build
And to add this new file to git
PS> git add .
To see the changes
PS> git status
To commit the changes
PS> git commit -m 'initial commit'
To see all commits
PS> git log
To push
PS> git push -u origin master
If we change file CMakeLists.txt we need to whire
PS> git add CMakeLists.txt
PS> git commit -m 'cmake minimum version lower'
PS> git push
Create a folder .github, there create a folder workflows, then create a file test.yaml
Instead of write evety time ...
cd build/
cmake ..
cmake --build .
./main 45
... we can customize cmake in github action
We can use googletest or Boost.Test
First we need to install googletest
PS> git clone https://github.com/google/googletest.git -b v1.15.2
PS> cd googletest/
PS> mkdir build/
PS> cmake -G "MinGW Makefiles" --install-prefix "C:\Program Files (x86)\googletest-distribution" ..
PS> cd..
PS> cmake --install build --prefix '/c/Program Files (x86)/googletest-distribution'
For my computer I need to add next lines in all CmakeLists.txt
set( CMAKE_CXX_COMPILER "/msys64/ucrt64/bin/g++.exe" )
set( CMAKE_C_COMPILER "/msys64/ucrt64/bin/gcc.exe" )
First, create a file "test_add.cpp" and add in test.yaml - run: ./build/tests