RunCMakeTest.cmake 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. include(RunCMake)
  2. if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
  3. run_cmake(LanguageStandard)
  4. endif()
  5. run_cmake(CustomCommandGenex)
  6. if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ")
  7. run_cmake(CustomCommandParallel)
  8. run_cmake(CustomCommandParallelDisable)
  9. endif()
  10. run_cmake_with_options(VsCharacterSet -DSET_CHARSET=MultiByte)
  11. run_cmake_with_options(VsCharacterSet -DSET_CHARSET=Unicode)
  12. run_cmake_with_options(VsCharacterSet -DSET_CHARSET=NotSet)
  13. run_cmake(VsCsharpSourceGroup)
  14. run_cmake(VsCSharpCompilerOpts)
  15. run_cmake(ExplicitCMakeLists)
  16. run_cmake(InterfaceLibSources)
  17. run_cmake(NoImpLib)
  18. run_cmake(RuntimeLibrary)
  19. run_cmake(SourceGroupCMakeLists)
  20. run_cmake(SourceGroupTreeCMakeLists)
  21. run_cmake(SourceGroupFileSet)
  22. run_cmake(VsConfigurationType)
  23. run_cmake(VsTargetsFileReferences)
  24. run_cmake(VsCustomProps)
  25. run_cmake(VsDebuggerWorkingDir)
  26. run_cmake(VsDebuggerCommand)
  27. run_cmake(VsDebuggerCommandArguments)
  28. run_cmake(VsDebuggerEnvironment)
  29. run_cmake(VsCSharpCustomTags)
  30. run_cmake(VsCSharpDocumentationFile)
  31. run_cmake(VsCSharpReferenceProps)
  32. run_cmake(VsCSharpWithoutSources)
  33. run_cmake(VsCSharpDeployFiles)
  34. run_cmake(VSCSharpDefines)
  35. run_cmake(VsSdkDirectories)
  36. run_cmake(VsGlobals)
  37. run_cmake(VsProjectImport)
  38. run_cmake(VsPackageReferences)
  39. run_cmake(VsDpiAware)
  40. run_cmake(VsDpiAwareBadParam)
  41. run_cmake(VsForceInclude)
  42. run_cmake(VsPrecompileHeaders)
  43. run_cmake(VsPrecompileHeadersReuseFromCompilePDBName)
  44. run_cmake(VsDeployEnabled)
  45. run_cmake(VsSettings)
  46. run_cmake(VsSourceSettingsTool)
  47. run_cmake(VsPlatformToolset)
  48. run_cmake(VsControlFlowGuardLinkSetting)
  49. run_cmake(VsToolOverride)
  50. run_cmake(VsWinRTByDefault)
  51. set(RunCMake_GENERATOR_TOOLSET "VCTargetsPath=$(VCTargetsPath)")
  52. run_cmake(VsVCTargetsPath)
  53. unset(RunCMake_GENERATOR_TOOLSET)
  54. if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05)
  55. run_cmake(VsJustMyCode)
  56. endif()
  57. if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.20)
  58. run_cmake(VsSpectreMitigation)
  59. endif()
  60. # Visual Studio 2017 has toolset version 141
  61. string(REPLACE "v" "" generator_toolset "${RunCMake_GENERATOR_TOOLSET}")
  62. if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR
  63. (RunCMake_GENERATOR_TOOLSET AND generator_toolset VERSION_LESS "141"))
  64. run_cmake(UnityBuildPre2017)
  65. else()
  66. run_cmake(UnityBuildNative)
  67. run_cmake(UnityBuildNativeGrouped)
  68. function(run_UnityBuildPCH)
  69. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/UnityBuildPCH-build)
  70. run_cmake(UnityBuildPCH)
  71. set(RunCMake_TEST_NO_CLEAN 1)
  72. set(vcxproj "${RunCMake_TEST_BINARY_DIR}/UnityBuildPCH.vcxproj")
  73. if(EXISTS "${vcxproj}")
  74. file(STRINGS ${vcxproj} vcxproj_strings REGEX "ClCompile[^\n]*UnityBuildPCH\\.c")
  75. endif()
  76. if(vcxproj_strings MATCHES "Include=\"([^\"]+)\"")
  77. set(src "${CMAKE_MATCH_1}")
  78. run_cmake_command(UnityBuildPCH-build ${CMAKE_COMMAND} --build . --config Debug --target UnityBuildPCH -- -t:ClCompile -p:SelectedFiles=${src})
  79. endif()
  80. endfunction()
  81. run_UnityBuildPCH()
  82. endif()
  83. run_cmake(VsDotnetStartupObject)
  84. run_cmake(VsDotnetTargetFramework)
  85. run_cmake(VsDotnetTargetFrameworkVersion)
  86. run_cmake(VsNoCompileBatching)
  87. run_cmake(DebugInformationFormat)
  88. run_cmake(VsCLREmpty)
  89. run_cmake(VsCLRPure)
  90. run_cmake(VsCLRSafe)
  91. run_cmake(VsFrameworkReference)
  92. if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.20)
  93. run_cmake(VsCLRNetcore)
  94. endif()