RunCMakeTest.cmake 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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(CMP0026-LOCATION)
  8. run_cmake(CMP0076-OLD)
  9. run_cmake(CMP0076-WARN)
  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(FileSetWrongTypeExperimental)
  27. run_cmake(FileSetDefaultWrongTypeExperimental)
  28. run_cmake(FileSetChangeScope)
  29. run_cmake(FileSetChangeType)
  30. run_cmake(FileSetWrongBaseDirs)
  31. run_cmake(FileSetWrongBaseDirsRelative)
  32. run_cmake(FileSetOverlappingBaseDirs)
  33. run_cmake(FileSetInstallMissingSetsPrivate)
  34. run_cmake(FileSetInstallMissingSetsInterface)
  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. if(APPLE)
  42. run_cmake(FileSetFramework)
  43. endif()
  44. set(RunCMake_TEST_NO_CLEAN 1)
  45. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/FileSetGeneratedDependency-build")
  46. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  47. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  48. run_cmake(FileSetGeneratedDependency)
  49. run_cmake_command(FileSetGeneratedDependency-build ${CMAKE_COMMAND} --build . --config Debug)
  50. unset(RunCMake_TEST_BINARY_DIR)
  51. unset(RunCMake_TEST_NO_CLEAN)
  52. set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW)
  53. run_cmake(FileSetFileNoExist)
  54. unset(RunCMake_TEST_OPTIONS)
  55. function(run_export_import name)
  56. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  57. set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release")
  58. else()
  59. set(_config_options -DCMAKE_BUILD_TYPE=Debug)
  60. endif()
  61. set(RunCMake_TEST_NO_CLEAN 1)
  62. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build")
  63. set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options})
  64. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  65. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  66. run_cmake(${name}Export)
  67. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug)
  68. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug)
  69. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  70. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release)
  71. run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release)
  72. endif()
  73. unset(RunCMake_TEST_OPTIONS)
  74. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Import-build")
  75. unset(RunCMake_TEST_OPTIONS)
  76. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  77. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  78. run_cmake(${name}Import)
  79. run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Debug)
  80. if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
  81. run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Release)
  82. endif()
  83. unset(RunCMake_TEST_BINARY_DIR)
  84. unset(RunCMake_TEST_NO_CLEAN)
  85. endfunction()
  86. run_export_import(FileSet)