more fixes in cmake
valgrind check: do not read potentially deleted variables