update cmake rules.

Conflicts:
	src/CMakeLists.txt

(Cherry picked from commit 8016ff140bdbdcfc4f7480dcd570b49378c1c3d9)