Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: alexchen on December 06, 2013, 11:44:47 pm
-
Is there a way to set a project's 'Build Targets' property to generate both static (.a) and dynamic (.so) libraries in the same build in Linux?
It seems the only way to build static and dynamic libraries is to have separate projects.
-
Is there a way to set a project's 'Build Targets' property to generate both static (.a) and dynamic (.so) libraries in the same build in Linux?
It seems the only way to build static and dynamic libraries is to have separate projects.
Did you try separate targets?
If not, try that. No idea if it works; but, I really think it should work.
Tim S.
-
You can have two seperate build targets and put them together in one virtual target, so both get build if you click on the build- or rebuild-button.
-
And if they share the same object dir (and object files) gcc won't need to compile twice, it will just link both ways from the same objects.
-
The original targets were 'Release' and 'Debug'. I create 'ReleaseStatic' and rename 'Release' to 'ReleaseDynamic' so that a new virtual target 'Release' can invoke both. However, the variable name $TARGET_NAME is tied to 'ReleaseDynamic' instead of 'Release' when I build 'Release' target, and that messes up my pre-build script, which keys on this value to select either 'Release' or 'Debug', not 'ReleaseStatic', 'ReleaseDynamic', 'DebugStatic', or 'DebugDynamic'.
If there is a variable name that represent all the object files, Maybe I can add a 'post-build' script to build static libraries when the dynamic library is built.