CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. include_directories(
  2. ${CMAKE_CURRENT_BINARY_DIR}
  3. ${CMake_BINARY_DIR}/Source
  4. ${CMake_SOURCE_DIR}/Source
  5. )
  6. set(CMakeLib_TESTS
  7. testGeneratedFileStream
  8. testRST
  9. testSystemTools
  10. testUTF8
  11. testXMLParser
  12. testXMLSafe
  13. )
  14. set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
  15. if(WIN32)
  16. list(APPEND CMakeLib_TESTS
  17. testVisualStudioSlnParser
  18. )
  19. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in
  20. ${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY)
  21. endif()
  22. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in
  23. ${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY)
  24. create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
  25. add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
  26. target_link_libraries(CMakeLibTests CMakeLib)
  27. # Xcode 2.x forgets to create the output directory before linking
  28. # the individual architectures.
  29. if(CMAKE_OSX_ARCHITECTURES AND XCODE
  30. AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
  31. add_custom_command(
  32. TARGET CMakeLibTests
  33. PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
  34. )
  35. endif()
  36. foreach(test ${CMakeLib_TESTS})
  37. add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS})
  38. endforeach()
  39. if(TEST_CompileCommandOutput)
  40. add_executable(runcompilecommands run_compile_commands.cxx)
  41. target_link_libraries(runcompilecommands CMakeLib)
  42. endif()
  43. add_subdirectory(PseudoMemcheck)