2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
2002-11-08 23:46:08 +03:00
|
|
|
|
2012-08-23 20:00:55 +04:00
|
|
|
|
|
|
|
# This module is shared by multiple languages; use include blocker.
|
|
|
|
if(__WINDOWS_MSVC)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
set(__WINDOWS_MSVC 1)
|
|
|
|
|
|
|
|
set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
|
|
|
|
set(CMAKE_LINK_LIBRARY_FLAG "")
|
|
|
|
set(MSVC 1)
|
|
|
|
|
2012-11-07 20:13:09 +04:00
|
|
|
# hack: if a new cmake (which uses CMAKE_LINKER) runs on an old build tree
|
2012-08-23 20:00:55 +04:00
|
|
|
# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache
|
|
|
|
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
|
|
|
|
# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex
|
|
|
|
if(NOT DEFINED CMAKE_LINKER)
|
|
|
|
set(CMAKE_LINKER link)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_VERBOSE_MAKEFILE)
|
|
|
|
set(CMAKE_CL_NOLOGO)
|
|
|
|
else()
|
|
|
|
set(CMAKE_CL_NOLOGO "/nologo")
|
|
|
|
endif()
|
|
|
|
|
2014-07-28 22:12:39 +04:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
|
2014-07-10 23:06:19 +04:00
|
|
|
set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
|
|
|
|
set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
|
|
|
|
set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
|
2012-09-05 12:08:58 +04:00
|
|
|
else()
|
|
|
|
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
|
|
|
|
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
|
2014-07-10 23:06:19 +04:00
|
|
|
set(_PLATFORM_LINK_FLAGS "")
|
2012-09-05 12:08:58 +04:00
|
|
|
endif()
|
2003-08-07 22:10:16 +04:00
|
|
|
|
2015-06-19 23:12:43 +03:00
|
|
|
set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1)
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
|
|
set (CMAKE_NO_BUILD_TYPE 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2005-01-20 20:30:03 +03:00
|
|
|
|
2012-08-23 19:20:48 +04:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
|
|
|
set(MSVC_IDE 1)
|
2012-08-31 00:08:16 +04:00
|
|
|
else()
|
|
|
|
set(MSVC_IDE 0)
|
2012-08-23 19:20:48 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT MSVC_VERSION)
|
2013-10-04 18:13:08 +04:00
|
|
|
if(CMAKE_C_SIMULATE_VERSION)
|
|
|
|
set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
|
|
|
|
elseif(CMAKE_CXX_SIMULATE_VERSION)
|
|
|
|
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
|
2013-10-11 21:54:50 +04:00
|
|
|
elseif(CMAKE_Fortran_SIMULATE_VERSION)
|
|
|
|
set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION})
|
2013-10-04 18:13:08 +04:00
|
|
|
elseif(CMAKE_C_COMPILER_VERSION)
|
2012-08-23 19:20:48 +04:00
|
|
|
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
|
|
|
|
else()
|
|
|
|
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
|
|
|
|
endif()
|
|
|
|
if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
|
|
math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(MSVC10)
|
|
|
|
set(MSVC11)
|
2013-06-29 00:12:08 +04:00
|
|
|
set(MSVC12)
|
2014-06-24 23:39:11 +04:00
|
|
|
set(MSVC14)
|
2012-08-23 19:20:48 +04:00
|
|
|
set(MSVC60)
|
|
|
|
set(MSVC70)
|
|
|
|
set(MSVC71)
|
|
|
|
set(MSVC80)
|
|
|
|
set(MSVC90)
|
|
|
|
set(CMAKE_COMPILER_2005)
|
|
|
|
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
2014-06-24 23:39:11 +04:00
|
|
|
if(NOT "${_compiler_version}" VERSION_LESS 19)
|
|
|
|
set(MSVC14 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 18)
|
2013-06-29 00:12:08 +04:00
|
|
|
set(MSVC12 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 17)
|
2012-08-23 19:20:48 +04:00
|
|
|
set(MSVC11 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 16)
|
|
|
|
set(MSVC10 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 15)
|
|
|
|
set(MSVC90 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 14)
|
|
|
|
set(MSVC80 1)
|
|
|
|
set(CMAKE_COMPILER_2005 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 13.10)
|
|
|
|
set(MSVC71 1)
|
|
|
|
elseif(NOT "${_compiler_version}" VERSION_LESS 13)
|
|
|
|
set(MSVC70 1)
|
|
|
|
else()
|
|
|
|
set(MSVC60 1)
|
|
|
|
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
2013-02-08 00:04:06 +04:00
|
|
|
if(MSVC_C_ARCHITECTURE_ID MATCHES 64 OR MSVC_CXX_ARCHITECTURE_ID MATCHES 64)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_CL_64 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_CL_64 0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
|
|
|
|
set(CMAKE_CL_64 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
|
|
|
if("${MSVC_VERSION}" GREATER 1599)
|
|
|
|
set(MSVC_INCREMENTAL_DEFAULT ON)
|
|
|
|
endif()
|
2002-12-05 21:44:11 +03:00
|
|
|
|
2004-07-05 20:16:33 +04:00
|
|
|
# default to Debug builds
|
2012-08-23 20:00:55 +04:00
|
|
|
set(CMAKE_BUILD_TYPE_INIT Debug)
|
|
|
|
|
2015-02-13 18:11:38 +03:00
|
|
|
# Compute an architecture family from the architecture id.
|
|
|
|
foreach(lang C CXX)
|
|
|
|
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}")
|
|
|
|
if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM")
|
|
|
|
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM")
|
|
|
|
elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH")
|
|
|
|
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2013-02-02 02:23:09 +04:00
|
|
|
if(WINCE)
|
2013-09-25 07:20:22 +04:00
|
|
|
foreach(lang C CXX)
|
|
|
|
string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER)
|
|
|
|
endforeach()
|
2012-09-05 12:08:58 +04:00
|
|
|
|
|
|
|
if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
|
|
math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
|
|
|
|
elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "")
|
|
|
|
set(_CE_VERSION "500")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}")
|
|
|
|
endif()
|
|
|
|
|
2015-02-13 18:10:26 +03:00
|
|
|
set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE /DWINCE")
|
2013-09-25 07:20:22 +04:00
|
|
|
set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_")
|
|
|
|
set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_")
|
2012-09-05 12:08:58 +04:00
|
|
|
|
|
|
|
set(_RTC1 "")
|
2015-02-13 18:14:34 +03:00
|
|
|
set(_FLAGS_C "")
|
2012-08-23 20:00:55 +04:00
|
|
|
set(_FLAGS_CXX " /GR /EHsc")
|
2015-02-13 18:14:34 +03:00
|
|
|
|
|
|
|
foreach(lang C CXX)
|
|
|
|
if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM")
|
|
|
|
set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}")
|
|
|
|
if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$")
|
|
|
|
set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2013-08-04 22:11:30 +04:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib")
|
2016-07-13 22:05:32 +03:00
|
|
|
foreach(t EXE SHARED MODULE)
|
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
|
|
|
|
endforeach()
|
2013-08-04 22:11:30 +04:00
|
|
|
|
2013-09-23 21:38:13 +04:00
|
|
|
if (MSVC_VERSION LESS 1600)
|
2016-07-28 01:41:13 +03:00
|
|
|
string(APPEND CMAKE_C_STANDARD_LIBRARIES_INIT " corelibc.lib")
|
2013-08-04 22:11:30 +04:00
|
|
|
endif ()
|
2014-07-28 22:56:13 +04:00
|
|
|
elseif(WINDOWS_PHONE OR WINDOWS_STORE)
|
2014-08-27 02:44:12 +04:00
|
|
|
set(_PLATFORM_DEFINES "/DWIN32")
|
2014-07-28 22:56:13 +04:00
|
|
|
set(_FLAGS_C " /DUNICODE /D_UNICODE")
|
|
|
|
set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
|
2015-10-02 21:34:55 +03:00
|
|
|
if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899)
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib")
|
|
|
|
elseif(WINDOWS_PHONE)
|
2014-07-31 21:08:53 +04:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib")
|
2015-02-13 18:11:38 +03:00
|
|
|
elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
|
2014-08-05 23:02:49 +04:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
|
2014-07-31 21:08:53 +04:00
|
|
|
else()
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-09-05 12:08:58 +04:00
|
|
|
set(_PLATFORM_DEFINES "/DWIN32")
|
|
|
|
|
2015-02-13 18:11:38 +03:00
|
|
|
if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
|
2014-08-05 23:02:49 +04:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
|
|
|
|
elseif(MSVC_VERSION GREATER 1310)
|
2016-09-28 09:46:00 +03:00
|
|
|
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "(v[0-9]+_clang_.*|LLVM-vs[0-9]+.*)")
|
2016-02-18 03:06:52 +03:00
|
|
|
# Clang/C2 in MSVC14 Update 1 seems to not support -fsantinize (yet?)
|
|
|
|
# set(_RTC1 "-fsantinize=memory,safe-stack")
|
|
|
|
set(_FLAGS_CXX " -frtti -fexceptions")
|
|
|
|
else()
|
|
|
|
set(_RTC1 "/RTC1")
|
|
|
|
set(_FLAGS_CXX " /GR /EHsc")
|
|
|
|
endif()
|
2012-09-05 12:08:58 +04:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
|
|
|
|
else()
|
|
|
|
set(_RTC1 "/GZ")
|
|
|
|
set(_FLAGS_CXX " /GR /GX")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
|
|
|
|
endif()
|
2012-11-16 21:52:59 +04:00
|
|
|
|
|
|
|
if(MSVC_VERSION LESS 1310)
|
|
|
|
set(_FLAGS_C " /Zm1000${_FLAGS_C}")
|
|
|
|
set(_FLAGS_CXX " /Zm1000${_FLAGS_CXX}")
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
|
2004-07-05 20:16:33 +04:00
|
|
|
|
2002-11-12 02:10:30 +03:00
|
|
|
# executable linker flags
|
2012-08-13 21:47:32 +04:00
|
|
|
set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
|
2012-11-23 20:41:58 +04:00
|
|
|
# set the machine type
|
2013-10-11 21:54:50 +04:00
|
|
|
if(MSVC_C_ARCHITECTURE_ID)
|
2015-02-13 18:11:38 +03:00
|
|
|
if(MSVC_C_ARCHITECTURE_ID MATCHES "^ARMV.I")
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:THUMB")
|
|
|
|
elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM")
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:ARM")
|
|
|
|
else()
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}")
|
|
|
|
endif()
|
2013-10-11 21:54:50 +04:00
|
|
|
elseif(MSVC_CXX_ARCHITECTURE_ID)
|
2015-02-13 18:11:38 +03:00
|
|
|
if(MSVC_CXX_ARCHITECTURE_ID MATCHES "^ARMV.I")
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:THUMB")
|
|
|
|
elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:ARM")
|
|
|
|
else()
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}")
|
|
|
|
endif()
|
2013-10-11 21:54:50 +04:00
|
|
|
elseif(MSVC_Fortran_ARCHITECTURE_ID)
|
|
|
|
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-07-26 19:15:28 +04:00
|
|
|
|
2010-05-04 05:29:08 +04:00
|
|
|
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
|
2006-07-26 19:15:28 +04:00
|
|
|
# on versions that support it
|
2012-08-13 21:47:32 +04:00
|
|
|
set( MSVC_INCREMENTAL_YES_FLAG "")
|
2014-07-28 22:50:57 +04:00
|
|
|
if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE)
|
|
|
|
if(NOT MSVC_INCREMENTAL_DEFAULT)
|
|
|
|
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
|
|
|
|
else()
|
|
|
|
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
|
|
|
|
2016-07-13 22:05:32 +03:00
|
|
|
foreach(t EXE SHARED MODULE)
|
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
|
|
|
|
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
2016-07-13 22:06:23 +03:00
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG_INIT " /debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
|
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_RELWITHDEBINFO_INIT " /debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
|
2016-07-13 22:05:32 +03:00
|
|
|
else ()
|
2016-07-13 22:06:23 +03:00
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG_INIT " /debug ${MSVC_INCREMENTAL_YES_FLAG}")
|
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_RELWITHDEBINFO_INIT " /debug ${MSVC_INCREMENTAL_YES_FLAG}")
|
2016-07-13 22:05:32 +03:00
|
|
|
endif ()
|
|
|
|
# for release and minsize release default to no incremental linking
|
2016-07-13 22:06:23 +03:00
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_MINSIZEREL_INIT " /INCREMENTAL:NO")
|
|
|
|
string(APPEND CMAKE_${t}_LINKER_FLAGS_RELEASE_INIT " /INCREMENTAL:NO")
|
2016-07-13 22:05:32 +03:00
|
|
|
endforeach()
|
2003-08-05 17:55:20 +04:00
|
|
|
|
2016-07-13 22:05:32 +03:00
|
|
|
string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
|
|
|
|
unset(_MACHINE_ARCH_FLAG)
|
2012-08-23 20:00:55 +04:00
|
|
|
|
|
|
|
macro(__windows_compiler_msvc lang)
|
2013-10-04 18:13:08 +04:00
|
|
|
if(NOT MSVC_VERSION LESS 1400)
|
2012-08-23 20:00:55 +04:00
|
|
|
# for 2005 make sure the manifest is put in the dll with mt
|
2015-09-16 17:24:16 +03:00
|
|
|
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
|
|
|
|
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
|
2012-08-23 20:00:55 +04:00
|
|
|
endif()
|
|
|
|
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
|
2014-07-10 23:06:19 +04:00
|
|
|
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
|
2012-08-23 20:00:55 +04:00
|
|
|
|
|
|
|
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
|
|
|
|
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
|
|
|
|
|
|
|
|
set(CMAKE_${lang}_COMPILE_OBJECT
|
2015-07-13 17:35:04 +03:00
|
|
|
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /Fo<OBJECT> /Fd<TARGET_COMPILE_PDB>${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
2012-08-23 20:00:55 +04:00
|
|
|
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
|
2015-07-13 17:35:04 +03:00
|
|
|
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
|
2012-08-23 20:00:55 +04:00
|
|
|
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
|
2015-07-13 17:35:04 +03:00
|
|
|
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
2012-08-23 20:00:55 +04:00
|
|
|
|
|
|
|
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
|
|
|
set(CMAKE_${lang}_LINK_EXECUTABLE
|
2014-07-10 23:06:19 +04:00
|
|
|
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
2012-08-23 20:00:55 +04:00
|
|
|
|
2016-07-05 18:43:31 +03:00
|
|
|
if("x${lang}" STREQUAL "xC" OR
|
|
|
|
"x${lang}" STREQUAL "xCXX")
|
2016-09-28 09:46:00 +03:00
|
|
|
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "(v[0-9]+_clang_.*|LLVM-vs[0-9]+.*)")
|
2016-07-05 18:43:31 +03:00
|
|
|
# note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects
|
|
|
|
# that include MS's own headers. CMake itself is affected project too.
|
2016-07-05 20:35:13 +03:00
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD -O2 -DNDEBUG")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
|
2016-07-05 18:43:31 +03:00
|
|
|
else()
|
2016-07-05 20:35:13 +03:00
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD /O2 /Ob2 /DNDEBUG")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD /Zi /O2 /Ob1 /DNDEBUG")
|
|
|
|
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD /O1 /Ob1 /DNDEBUG")
|
2016-07-05 18:43:31 +03:00
|
|
|
endif()
|
2016-02-18 03:06:52 +03:00
|
|
|
endif()
|
2014-07-25 00:18:21 +04:00
|
|
|
set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
|
2015-10-20 20:52:12 +03:00
|
|
|
set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
|
2015-02-25 19:15:51 +03:00
|
|
|
|
2015-05-07 18:43:02 +03:00
|
|
|
if(NOT CMAKE_RC_COMPILER_INIT)
|
|
|
|
set(CMAKE_RC_COMPILER_INIT rc)
|
|
|
|
endif()
|
2015-02-25 19:26:48 +03:00
|
|
|
if(NOT CMAKE_RC_FLAGS_INIT)
|
2016-07-05 20:35:13 +03:00
|
|
|
string(APPEND CMAKE_RC_FLAGS_INIT " ${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
|
2015-02-25 19:26:48 +03:00
|
|
|
endif()
|
|
|
|
|
2015-02-25 19:15:51 +03:00
|
|
|
enable_language(RC)
|
2015-10-20 20:52:12 +03:00
|
|
|
set(CMAKE_NINJA_CMCLDEPS_RC 1)
|
2012-08-23 20:00:55 +04:00
|
|
|
endmacro()
|