Added a CMake option to compile SFML with static VC++ runtime

This commit is contained in:
Laurent Gomila 2011-03-26 23:24:09 +01:00
parent 12245224a4
commit 293cacfbda

View File

@ -40,6 +40,20 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif() 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 # disable the rpath stuff
set(CMAKE_SKIP_BUILD_RPATH TRUE) 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}) install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
if(WINDOWS) if(WINDOWS)
install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin) install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin)
install(FILES extlibs/bin/openal32.dll DESTINATION bin) install(FILES extlibs/bin/openal32.dll DESTINATION bin)
elseif(MACOSX) elseif(MACOSX)
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION /Library/Frameworks PATTERN ".svn" EXCLUDE) install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION /Library/Frameworks PATTERN ".svn" EXCLUDE)
endif() endif()