[CMake] linker library order

Philip Lowman philip at yhbt.com
Tue Aug 7 16:41:58 EDT 2007


Jon W wrote:
> I need to have a specific library linked before all other libraries.
> For example, I need foo.lib linked  before the defaults, "
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> odbccp32.lib".
> 
> What would be the best way to accomplish this behavior?

Why do you need to specify foo.lib before the standard Win32 libraries?
 Unless this is an attempt to reimplement Microsoft's standard libraries
with your own code I don't see what placing foo.lib before all of the
standard win32 libraries would buy you.

Here's an idea for you though if you really need to do this.  You could
probably globally modify your project defaults and remove the libraries
you don't want from the defaults and add them back in later via
TARGET_LINK_LIBRARIES.

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Please note that this would break linking of any projects you're
developing on the machine unless they declared an explicit dependency on
system32.lib, user32.lib, etc.

I've never actually tried this before but I've added libraries as per
the webpage to make VS Express work better out of the box with the
Platform SDK.

-- 
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com


More information about the CMake mailing list