I've just created an Helloworld in C++ using Cmake.
Output binary is, as expected, 10KB.
When I add #include <string>
in main without using any strings, the generated binary turn to 100KB.
When I manually compile same main.cpp file gcc main.cpp -o helloworld
, the output binary has same size, with or without #include <string>
Is there any Cmake keyword to use in order to allow the output binary includes everything dynamically, instead of having all libraries internally?
I've got the problem. In my CMakeLists.txt file was present
add_compile_options(-Wall -Werror -std=c++17 -g)
So
-DCMAKE_BUILD_TYPE=Release
did not have any effect.
I just removed -g
parameter and Debug symbols simply disappear from output binary