We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2250

Summary: Cmake: SDL2 Doesn't install DLLs on Windows
Product: SDL Reporter: ernest.lee
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: srcluv+libsdl
Version: HG 2.1   
Hardware: x86_64   
OS: Windows 7   
Attachments: Cmake patch
sdl-log
patch.diff

Description ernest.lee 2013-11-18 22:06:40 UTC
Created attachment 1456 [details]
Cmake patch

[Exec] CMake Error at cmake_install.cmake:151 (FILE):
[13:37:43][Exec]   file INSTALL cannot find
[13:37:43][Exec]   "C:/TeamCity/buildAgent/work/2e3d17a492e75daf/Build/libSDL2.so".

The cmake INSTALL project doesn't work because it uses Linux so shared library paths. Windows uses dlls and I think cygwin also uses dlls. I've included this patch. Can you check if it works?
Comment 1 srcluv+libsdl 2014-02-08 15:52:58 UTC
I tested the patch and works correctly except for a warning being shown. Removing the offending endif argument at line 1225 fixed it.

CMake Warning (dev) in CMakeLists.txt:
  A logical block opening on the line

    Z:/downloads/SDL2-2.0.1/CMakeLists.txt:1218 (if)

  closes on the line

    Z:/downloads/SDL2-2.0.1/CMakeLists.txt:1225 (endif)

  with mis-matching arguments.
This warning is for project developers.  Use -Wno-dev to suppress it.
Comment 2 Sam Lantinga 2014-02-09 10:05:21 UTC
Can you try this revision and see if it works?
http://hg.libsdl.org/SDL/rev/aada7c5bd410

Thanks!
Comment 3 ernest.lee 2014-02-09 11:16:03 UTC
I built revision 1af779813349, but it's complaining at  

[Step 3/3] Linking C static library libSDL2.a
[Step 3/3] C:\MinGW\bin\ar.exe: /NODEFAULTLIB: No such file or directory
[Step 3/3] CMakeFiles\SDL2-static.dir\build.make:3130: recipe for target 'libSDL2.a' failed
[Step 3/3] mingw32-make[2]: *** [libSDL2.a] Error 1
[Step 3/3] CMakeFiles\Makefile2:97: recipe for target 'CMakeFiles/SDL2-static.dir/all' failed
[Step 3/3] mingw32-make[1]: *** [CMakeFiles/SDL2-static.dir/all] Error 2
[Step 3/3] Makefile:115: recipe for target 'all' failed
[Step 3/3] mingw32-make: *** [all] Error 2
[Step 3/3] Process exited with code 2
[Step 3/3] Step Command Line failed

Log is in attachments.
Comment 4 ernest.lee 2014-02-09 11:16:45 UTC
Created attachment 1552 [details]
sdl-log
Comment 5 Sam Lantinga 2014-02-09 11:24:27 UTC
Hey Ryan, can you take a look at this?
Comment 6 ernest.lee 2014-02-09 11:38:53 UTC
Created attachment 1553 [details]
patch.diff

Here's a patch that disables /NODEFAULTLIBS.
Comment 7 Sam Lantinga 2014-02-09 20:35:12 UTC
I don't think we want to remove /NODEFAULTLIBS as that would introduce a dependency on the C runtime.
Comment 8 ernest.lee 2014-02-14 15:02:23 UTC
It's impossible to use /NODEFAULTLIBS  on gcc.
Comment 9 ernest.lee 2014-02-14 15:07:10 UTC
As it's a cl command switch...
Comment 10 Ryan C. Gordon 2014-03-07 05:20:07 UTC
This should be fixed by https://hg.libsdl.org/SDL/rev/be2102f000d0

--ryan.