add_definitions(-DG4_USESMARTSTACK)
version: 0.206-28599
Calling cmake -DG4_USESMARTSTACK … will not work, because that sets a CMake cache variable. What we want is to pass a preprocessor macro in g++. The proper way to do that is to add the following in the CMakeLists.txt file:
add_definitions(-DG4_USESMARTSTACK)
or modify the CMAKE_CXX_FLAGS variable, again inside the CMakeLists.txt.
Also, for if building the granular libraries with gmake, one needs to add -DG4_USESMARTSTACK in the respective GNUmakefile (geant4.9.5.p01/source/event/GNUmakefile):
CPPFLAGS += -DG4EVENT_ALLOC_EXPORT -DG4_USESMARTSTACK