check_c_compiler_flag does not actually pass the flag to the linker, and
so the test file successfully compiles for any linker flag. This
caused the -Wl,z,relro flag to be passed to the compiler even if it was
not supported.
check_c_compiler_flag was introduced in cmake 3.18, so this commit also
bumps the minimum required cmake version to 3.18 (released in 2020).
Fix crash bug when build with libncursesw.so.6 and libtinfow.so.6
The FindCurses.cmake is too old to build with
```-DCURSES_NEED_WIDE=TRUE``` option.
In some latest ENV, always using libncursesw.so.6 and libtinfow.so.6.
The nvtop will crashed with these messages below:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==50432==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000c8 (pc 0x7f9c4d507d39 bp 0x7f9c4d4e6de8 sp 0x7ffc057963a8 T0)
==50432==The signal is caused by a READ memory access.
==50432==Hint: address points to the zero page.
#0 0x7f9c4d507d38 in termattrs_sp (/lib64/libncursesw.so.6+0x1fd38)
#1 0x7f9c4d504f73 in _nc_setupscreen_sp (/lib64/libncursesw.so.6+0x1cf73)
#2 0x7f9c4d50078b in newterm_sp (/lib64/libncursesw.so.6+0x1878b)
#3 0x7f9c4d500c08 in newterm (/lib64/libncursesw.so.6+0x18c08)
#4 0x7f9c4d4fca53 in initscr (/lib64/libncursesw.so.6+0x14a53)
#5 0x55bd7f6d693d in initialize_curses (/usr/local/bin/nvtop+0x5893d)
#6 0x55bd7f6c9f7a in main (/usr/local/bin/nvtop+0x4bf7a)
#7 0x7f9c4c998f1a in __libc_start_main (/lib64/libc.so.6+0x23f1a)
#8 0x55bd7f6ca789 in _start (/usr/local/bin/nvtop+0x4c789)
```
The load library have some problem, NOTE libtinfow.so.6 and
libtinfo.so.6 load at the same time, it is the root cause.
```
ldd /usr/local/bin/nvtop
linux-vdso.so.1 (0x00007ffca6d82000)
libasan.so.5 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libasan.so.5 (0x00007f8823464000)
libm.so.6 => /lib64/libm.so.6 (0x00007f8823326000)
libnvidia-ml.so.1 => /usr/lib64/libnvidia-ml.so.1 (0x00007f8822d00000)
libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007f8822cc5000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f8822c89000)
libubsan.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libubsan.so.1 (0x00007f8822321000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8822152000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f882214c000)
librt.so.1 => /lib64/librt.so.1 (0x00007f8822142000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8822120000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libstdc++.so.6 (0x00007f8821ea8000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libgcc_s.so.1 (0x00007f8821e8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8823fc5000)
libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007f8821e4f000)
```
To fix it, the FindCurses.cmake should using libtinfow.so.6 instead of
libtinfo.so.6 when DCURSES_NEED_WIDE=TRUE. So I updated the
FindCurses.cmake to latest version to fix this problem.
Signed-off-by: Huang Rui <vowstar@gmail.com>