From c3c2964dbb4f922e67e0cbf7d84b8a8d29940e7a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 9 Feb 2014 02:04:40 -0800 Subject: [PATCH] Possibly fixed bug 2250 - Cmake: SDL2 Doesn't install DLLs on Windows ernest.lee [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? --- CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb37448ed..809459b39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1277,14 +1277,13 @@ endforeach() list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2) -if(SDL_SHARED) - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.so\" \"libSDL2.so\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") -endif() - if(NOT WINDOWS OR CYGWIN) + if(SDL_SHARED) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"libSDL2-2.0.so\" \"libSDL2.so\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") + endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") @@ -1295,5 +1294,7 @@ if(NOT WINDOWS OR CYGWIN) install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin) # 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) endif()