CMakeLists.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. include_directories(
  2. ${CMAKE_CURRENT_BINARY_DIR}
  3. ${CMake_BINARY_DIR}/Source
  4. ${CMake_SOURCE_DIR}/Source
  5. ${CMake_SOURCE_DIR}/Source/CTest
  6. )
  7. set(CMakeLib_TESTS
  8. testArgumentParser.cxx
  9. testCTestBinPacker.cxx
  10. testCTestResourceAllocator.cxx
  11. testCTestResourceSpec.cxx
  12. testCTestResourceGroups.cxx
  13. testGccDepfileReader.cxx
  14. testGeneratedFileStream.cxx
  15. testJSONHelpers.cxx
  16. testRST.cxx
  17. testRange.cxx
  18. testOptional.cxx
  19. testString.cxx
  20. testStringAlgorithms.cxx
  21. testSystemTools.cxx
  22. testUTF8.cxx
  23. testXMLParser.cxx
  24. testXMLSafe.cxx
  25. testFindPackageCommand.cxx
  26. testUVProcessChain.cxx
  27. testUVRAII.cxx
  28. testUVStreambuf.cxx
  29. testCMExtMemory.cxx
  30. testCMExtAlgorithm.cxx
  31. testCMExtEnumSet.cxx
  32. testList.cxx
  33. )
  34. if(CMake_ENABLE_DEBUGGER)
  35. list(APPEND CMakeLib_TESTS
  36. testDebuggerAdapter.cxx
  37. testDebuggerAdapterPipe.cxx
  38. testDebuggerBreakpointManager.cxx
  39. testDebuggerVariables.cxx
  40. testDebuggerVariablesHelper.cxx
  41. testDebuggerVariablesManager.cxx
  42. )
  43. endif()
  44. if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM)
  45. list(APPEND CMakeLib_TESTS testCMFilesystemPath.cxx)
  46. endif()
  47. add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx)
  48. target_link_libraries(testUVProcessChainHelper CMakeLib)
  49. set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
  50. set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>)
  51. set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>)
  52. set(testCTestResourceSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
  53. set(testGccDepfileReader_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
  54. if(WIN32)
  55. list(APPEND CMakeLib_TESTS
  56. testVisualStudioSlnParser.cxx
  57. )
  58. configure_file(testVisualStudioSlnParser.h.in testVisualStudioSlnParser.h @ONLY)
  59. endif()
  60. configure_file(testXMLParser.h.in testXMLParser.h @ONLY)
  61. file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORLD!")
  62. create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
  63. add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
  64. target_link_libraries(CMakeLibTests CMakeLib CTestLib)
  65. if(CMake_BUILD_PCH)
  66. target_precompile_headers(CMakeLibTests PRIVATE "<iostream>" "<cm3p/uv.h>")
  67. target_compile_definitions(CMakeLibTests PRIVATE "NOMINMAX")
  68. endif()
  69. set_property(TARGET CMakeLibTests PROPERTY C_CLANG_TIDY "")
  70. set_property(TARGET CMakeLibTests PROPERTY CXX_CLANG_TIDY "")
  71. add_executable(testEncoding testEncoding.cxx)
  72. target_link_libraries(testEncoding cmsys)
  73. foreach(testfile ${CMakeLib_TESTS})
  74. get_filename_component(test "${testfile}" NAME_WE)
  75. add_test(NAME CMakeLib.${test} COMMAND CMakeLibTests ${test} ${${test}_ARGS})
  76. endforeach()
  77. if(TEST_CompileCommandOutput)
  78. add_executable(runcompilecommands run_compile_commands.cxx)
  79. target_link_libraries(runcompilecommands CMakeLib)
  80. endif()
  81. add_subdirectory(PseudoMemcheck)
  82. add_executable(testAffinity testAffinity.cxx)
  83. target_link_libraries(testAffinity CMakeLib)
  84. if(CMake_ENABLE_DEBUGGER)
  85. add_executable(testDebuggerNamedPipe testDebuggerNamedPipe.cxx)
  86. target_link_libraries(testDebuggerNamedPipe PRIVATE CMakeLib)
  87. set(testDebuggerNamedPipe_Project_ARGS
  88. "$<TARGET_FILE:cmake>" ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample ${CMAKE_CURRENT_BINARY_DIR}/DebuggerSample
  89. )
  90. set(testDebuggerNamedPipe_Script_ARGS
  91. "$<TARGET_FILE:cmake>" ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample/script.cmake
  92. )
  93. foreach(case Project Script)
  94. add_test(NAME CMakeLib.testDebuggerNamedPipe-${case} COMMAND testDebuggerNamedPipe ${testDebuggerNamedPipe_${case}_ARGS})
  95. set_property(TEST CMakeLib.testDebuggerNamedPipe-${case} PROPERTY TIMEOUT 300)
  96. endforeach()
  97. endif()