builder/cmake: Add workaround for some gcc linker woes
builder/cmake: Add workaround for some gcc linker woes

I'm using Ubuntu 14.04.5 LTS which is using gcc (Ubuntu
4.8.4-2ubuntu1~14.04.4) 4.8.4, and linker in this version seems to be
having some linking issues with libraries specified before other
objects, leading to following linker error on native:

 gcc -m32 -Wall -Werror -ggdb -DMN_LINUX -O0 -lm -lutil
   my_blinky_sim/app/apps/blinky/null.c.obj
   -o my_blinky_sim/app/apps/blinky/libblinky.elf
   -Wl,--start-group
     <snipped>
   -Wl,--end-group

 libhw_mcu_native.a(hal_uart.c.obj): In function `uart_pty':
 native/src/hal_uart.c:282: undefined reference to `openpty'

 libkernel_os.a(os_time.c.obj): In function `os_time_ms_to_ticks':
 kernel/os/src/os_time.c:256: undefined reference to `__udivdi3'

To fix this error, we need to supply link library dependencies also as the
last command line flags to the linker command:

 gcc -m32 -Wall -Werror -ggdb -DMN_LINUX -O0 -lm -lutil
   -Wl,--start-group
     <snipped>
   -Wl,--end-group
   -lm -lutil

Signed-off-by: Petr Štetiar <f0d4d86d9c7002e67e6ae7bb5596bc0afa7b4c3a@true.cz>

apache/incubator-mynewt-newt,apache/incubator-mynewt-newt