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 2478

Summary: Setting SDL_SHARED=OFF makes last install step fail in 2.0.3
Product: SDL Reporter: Fredrik Zetterman <fredrik.zetterman>
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.3   
Hardware: x86_64   
OS: Windows 7   

Description Fredrik Zetterman 2014-04-04 10:46:02 UTC
I call the SDL CMakeLists.txt from one of our own CMakeLists.txt using the ExternalProject_Add function.

If I set the following CMake args when building: 
-DSDL_STATIC=ON -DSDL_SHARED=OFF

I get the following output:

1>  --  Build Shared Library: OFF
1>  --  Build Static Library: ON
1>  -- 
1>  CMake Error at CMakeLists.txt:1308 (install):
1>    install TARGETS given target "SDL2" which does not exist in this directory.

It also makes sense, because the static lib target name is called SDL2-static. The following seems to fix the problem:

@@ -1304,6 +1304,8 @@ if(NOT WINDOWS OR CYGWIN)
   # TODO: what about the .spec file? Is it only needed for RPM creation?
   install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
 else()
-  install(TARGETS SDL2 RUNTIME DESTINATION bin)
+	if(SDL_SHARED)
+		install(TARGETS SDL2 RUNTIME DESTINATION bin)
+	endif()
 endif()
Comment 1 Sam Lantinga 2014-04-18 05:28:42 UTC
Ryan, is this the correct fix?
Comment 2 Sam Lantinga 2014-04-18 05:32:14 UTC
Actually it looks like the patch in bug 2474 might be a better fix.

*** This bug has been marked as a duplicate of bug 2474 ***