CMakeLists.txt 3.8 KB

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