After running the build process at my end it turns out I was wrong about adding atomic to line 51 of gcs/src/CMakeLists.txt so remove it if you have added it already.
The atomic library needs to be added to the following files:
Line 31 in file garb/CMakeLists.txt
https://github.com/MariaDB/galera/blob/mariadb-4.x/garb/CMakeLists.txt#L31
target_link_libraries(garbd gcs4garb gcomm gcache atomic ${Boost_PROGRAM_OPTIONS_LIBRARIES})
Line 20 in file wsrep/tests/CMakeLists.txt
https://github.com/MariaDB/galera/blob/mariadb-4.x/wsrep/tests/CMakeLists.txt#L20
target_link_libraries(wsrep_test dl atomic)
If those changes work for you at your end I will create a patch file and add it to the guide and I will see if I can ask the Galera project owners if the changes can go into the project.