From 293cacfbdab7618f7bceece82f14e2fbce375e94 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Sat, 26 Mar 2011 23:24:09 +0100 Subject: [PATCH] Added a CMake option to compile SFML with static VC++ runtime --- CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 293bc9e2..d5170745 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,20 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif() +# define an option for choosing between static CRT and DLL CRT (with Visual C++) +if(COMPILER_MSVC) + set(FORCE_STATIC_VCRT FALSE CACHE BOOL "TRUE to force static VC++ runtimes, FALSE to use the DLL ones") + if(FORCE_STATIC_VCRT) + foreach(flag + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + endif() + endforeach() + endif() +endif() + # disable the rpath stuff set(CMAKE_SKIP_BUILD_RPATH TRUE) @@ -61,7 +75,7 @@ install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${CMAKE_ROOT}/Modules) install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR}) if(WINDOWS) install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin) - install(FILES extlibs/bin/openal32.dll DESTINATION bin) -elseif(MACOSX) + install(FILES extlibs/bin/openal32.dll DESTINATION bin) +elseif(MACOSX) install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION /Library/Frameworks PATTERN ".svn" EXCLUDE) endif()