Answer the question
In order to leave comments, you need to log in
CMake and static linking
There is a small self-written cross-platform toy using SDL. C++ language. Under Win32 and Win64 builds in mingw-w64, gcc 4.5.1.
I would like the following: in assemblies under Windows, link dependencies statically. I don't feel like lugging around a good dozen libraries. Now in the build environment there are both versions of libraries: for static and dynamic linking. By default, gcc prefers to link dynamically. In order for it to select static versions of libraries, you need to add the -static key before them. And then you need to add the -dynamic key before the libraries that are linked dynamically (OpenGL).
Question: how to force/teach cmake to build the required command line?
Answer the question
In order to leave comments, you need to log in
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
Your code...
else()
Your code...
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
www.paraview.org/Wiki/CMake_Useful_Variables
If my memory serves me, then for target_link_libraries it doesn't matter if the link is static or dynamic.
If you want some specific option to the compiler or linker, then in these cases use set_target_properties. There are COMPILE_FLAGS and LINK_FLAGS and a bunch of other things (see www.cmake.org/cmake/help/v2.8.12/cmake.html#section_PropertiesonTargets )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question