Add _XOPEN_SOURCE_EXTENDED in cmake

Move _XOPEN_SOURCE_EXTENDED from header file to cmake to be sure it is
present before including curses.h.