CMake and static linking

There is a small self-written parser cross-platform toy using SDL. The C++ Language. Under Win32 and Win64 is going in mingw-w64, gcc 4.5.1.

I want the following: in Assembly under Windows, link the dependencies statically. Not hunting to carry over a dozen libraries. Now in the build environment have both versions of libraries: static and dynamic linking. By default, gcc prefers to link dynamically. So he chose the static version of the libraries you want to add to them the key static. And then in front required libraries that are dynamically linkouts (OpenGL), add key -dynamic.

Question: how to make/teach cmake to collect the necessary command line?
October 10th 19 at 03:24
2 answers
October 10th 19 at 03:26
Your code...
Your code...
Enough if(WIN32). But that's not the question. - Javon_Tillm commented on October 10th 19 at 03:29
October 10th 19 at 03:28
If I remember correctly, for target_link_libraries no difference Libin static or dynamic.
If you want a specific option to the compiler or linker, in these cases, using set_target_properties. There are COMPILE_FLAGS and LINK_FLAGS, and lots of other things (see

Find more questions by tags MinGWCMakeC++GCC