[CMake] Check if libncurses is actually needed by libreadline