Fix some CMake linker problems.

The changes were introduced by recent SDL related changes.
Make a function static.
Remove redundant declarations.