[CMake] MinGW generator: Avoiding -Lc:\windows\system32 on linking

William A. Hoffman billlist at nycap.rr.com
Fri Sep 15 08:22:52 EDT 2006


At 05:34 AM 9/15/2006, Johan Seland wrote:
>Hello.
>
>I have been a happy user of CMake for the last couple of monts (both
>on Linux and using MinGW on WinXP), but have currently run into an
>annoying problem.
>
>I have to do a project using DirectX and need to link with GDI32,
>WINMM and D3D9.
>I have used the reimp tool to generate Mingw libs for the DX9 libraries.
>
>Cmake 2.4 using the MinGW Makefile Generator compiles my source files
>perfectly, but during linking it adds -Lc:\windows\system32 to the
>command line, which causes error in the form of "multiple definition
>of `_onexit'" as well as many undefined references. However, if I
>manually remove the -Lc:\windows\system32 flag from the linker command
>line, my program links and runs as it should.
>
>Is there anyway to avoid getting this flag into the generated
>makefiles? Setting LINK_DIRECTORIES to empty or a dummy path does not
>seem to help.

CMake does not automatically add windows/system32.  You must be linking
in a full path to some .lib in that directory.   If you stop doing that
cmake will stop adding the -L flag.

-Bill



More information about the CMake mailing list