The usual way to simplify complication for the user (or indeed for the developer) is to write a makefile.
First, it's gcc -lm and no there is no #pragma meant to give linking directives
gcc -lm
#pragma
No, you need to tell the linker to link the library in order to link the library.
The linker doesn't know about the code, only the compiled object files. It won't see a language specific pragma.