How to install Geant4 using cmake 3.14.5 and visual studio 2017 step-1 Download Geant4 and extract in a folder like J:Geant4\geant4_10_05 (this is the source folder that contain geant4 source) step-2 Now create one for build like J:\Geant4\geant4-build step-3 switch to this build folder by cd geant4-build step-4 cmake -DCMAKE_INSTALL_PREFIX=J:\Geant4\geant4_10_05-install J:\Geant4\geant4_10_05 step-4 Instead of running cmake command in step 4, you can run cmake-gui where you installed cmake, it will be in bin folder (J:\cmake-3.14.5-win64-x64\bin) step-5 You can set any value like geant4 dataset and openGL library and QT as (you must be in build folder like ) J:\Geant4\geant4-build cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_WIN32=ON -DGEANT4_USE_QT=ON step-6 cmake --build . --config RelWithDebInfo (this will install everything in your installed directory -DCMAKE_INSTALL_PREFIX) step-7 download the data files if -DGEANT4_INSTALL_DATA=ON and set the environment variables How to run example step-1 Make a directory where to keep the build files mkdir b2_build step-2 move into this new directory cd b2_build step-3 run the cmake command ( cmake command, Geant4 installation path, example/application path which needs to be build) D:\GEANT\b2_b>cmake -DGeant4_DIR=d:\Geant4\lib\Geant4-G4VERSION d:\GEANT\B2 Now check the solution file example.sln by typing dir /B step-4 now build solution by typing cmake --build . --config Release step-5 now your example.exe is ready in release folder cd release run example.exe from terminal (you can run macro as example.exe ..\run1.mac) preInit> /run/initialize