Every time when project is compiled , .elf(executable) is changing.


Every time when project is compiled there should be a change only in time stamp in executable file . But there are few addresses which are updating regularly when project is compiled. Is this a normal behavior of Cmake or are there any flags which needs to be added in CmakeLists.txt file?


This is probably more a behavior of the linker you’re using. Does it produce consistent binaries outside of CMake?

Maybe try things from here: https://reproducible-builds.org/docs/

I am usingTasking linker. Yes it is producing consistent binaries outside Cmake.

I would start looking at the commands CMake runs and adding flags until it shows the same behavior. Then the problematic flag’s source can be investigated.