I have a huge bundle of multi-threaded source codes which includes five statically linked libraries (which is also an project of the same solution). I use CMake tool(Version 3.7.1) for generating solution for MSVC(VS2015) and Makefile for Linux (Unix Makefiles). Since it has to run on multiple platform, all the platform specific header files are included separately.
I have worked more on Windows build most of the time with optimization value as
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd /O0")
and for Linux
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fpermissive -Os")
But the size of the binaries vary in huge size. On Windows it is 1,698KB and on Linux it is 17121988 Bytes, approx 16MB.
As there are two different build options (Release and Debug) do we have similar to Linux. If so how should differentiate those build options.
Also I use add_definition("-W -Wall -Wextra -Wno-unused-parameter -Wno-overloaded-virtual -Wconversion -ggdb")
How the minimize the Linux binary size. I have seen similar post like these but the question is vice versa for me.