RunCMakeTest.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. include(RunCMake)
  2. if(RunCMake_GENERATOR STREQUAL "Xcode")
  3. run_cmake(ConfigNotAllowed)
  4. endif()
  5. run_cmake(EmptyKeywordArgs)
  6. run_cmake(OriginDebug)
  7. run_cmake(CMP0076-OLD)
  8. run_cmake(CMP0076-WARN)
  9. run_cmake(MissingSource)
  10. run_cmake(RelativePathInInterface)
  11. run_cmake(RelativePathInSubdirGenEx)
  12. run_cmake(RelativePathInSubdirInterface)
  13. run_cmake(RelativePathInSubdirPrivate)
  14. run_cmake(RelativePathInSubdirInclude)
  15. run_cmake(ExportBuild)
  16. run_cmake(AddCustomTargetPublicSources)
  17. run_cmake(AddCustomTargetPrivateSources)
  18. run_cmake(AddCustomTargetInterfaceSources)
  19. run_cmake(AddCustomTargetSources)
  20. run_cmake(AddCustomTargetCheckProperty)
  21. run_cmake(AddCustomTargetGenx)
  22. run_cmake(FileSetProperties)
  23. run_cmake(FileSetNoType)
  24. run_cmake(FileSetWrongType)
  25. run_cmake(FileSetDefaultWrongType)
  26. run_cmake(FileSetChangeScope)
  27. run_cmake(FileSetChangeType)
  28. run_cmake(FileSetWrongBaseDirs)
  29. run_cmake(FileSetWrongBaseDirsRelative)
  30. run_cmake(FileSetOverlappingBaseDirs)
  31. run_cmake(FileSetInstallMissingSetsPrivate)
  32. run_cmake(FileSetInstallMissingSetsInterface)
  33. run_cmake(FileSetInstallMissingSetsInterfacePostInstall)
  34. run_cmake(FileSetExportMissingSetsInterfacePostExport)
  35. run_cmake(FileSetReadOnlyPrivate)
  36. run_cmake(FileSetReadOnlyInterface)
  37. run_cmake(FileSetNoExistInstall)
  38. run_cmake(FileSetDirectories)
  39. run_cmake(FileSetCustomTarget)
  40. run_cmake(FileSetBadName)
  41. run_cmake(FileSetWrongSyntax)
  42. run_cmake(FileSetDirect)
  43. if(APPLE)
  44. run_cmake(FileSetFramework)
  45. endif()
  46. set(RunCMake_TEST_NO_CLEAN 1)
  47. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/FileSetGeneratedDependency-build")
  48. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  49. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  50. run_cmake(FileSetGeneratedDependency)
  51. run_cmake_command(FileSetGeneratedDependency-build ${CMAKE_COMMAND} --build . --config Debug)
  52. unset(RunCMake_TEST_BINARY_DIR)
  53. unset(RunCMake_TEST_NO_CLEAN)
  54. set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW)
  55. run_cmake(FileSetFileNoExist)
  56. unset(RunCMake_TEST_OPTIONS)
  57. function(run_export_import name)
  58. if(ARGV1)
  59. set(importname ${ARGV1})
  60. else()
  61. set(importname ${name})
  62. endif()
  63. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  64. set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release")
  65. else()
  66. set(_config_options -DCMAKE_BUILD_TYPE=Debug)
  67. endif()
  68. set(RunCMake_TEST_NO_CLEAN 1)
  69. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build")
  70. set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options})
  71. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  72. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  73. run_cmake(${name}Export)
  74. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug)
  75. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug)
  76. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  77. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release)
  78. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release)
  79. endif()
  80. unset(RunCMake_TEST_OPTIONS)
  81. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${importname}Import-build")
  82. unset(RunCMake_TEST_OPTIONS)
  83. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  84. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  85. run_cmake(${importname}Import)
  86. run_cmake_command(${importname}Import-build ${CMAKE_COMMAND} --build . --config Debug)
  87. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  88. run_cmake_command(${importname}Import-build ${CMAKE_COMMAND} --build . --config Release)
  89. endif()
  90. unset(RunCMake_TEST_BINARY_DIR)
  91. unset(RunCMake_TEST_NO_CLEAN)
  92. endfunction()
  93. run_export_import(FileSet)
  94. run_export_import(FileSetInstallFirst FileSet)
  95. run_export_import(FileSetAbsoluteInstallIncludeDir)