CMake: Fixed non-matching conditions in if() and endif() block.