CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. testFindPackageCommand
  14. )
  15. set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
  16. if(WIN32)
  17. list(APPEND CMakeLib_TESTS
  18. testVisualStudioSlnParser
  19. )
  20. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in
  21. ${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY)
  22. endif()
  23. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in
  24. ${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY)
  25. create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
  26. add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
  27. target_link_libraries(CMakeLibTests CMakeLib)
  28. # Xcode 2.x forgets to create the output directory before linking
  29. # the individual architectures.
  30. if(CMAKE_OSX_ARCHITECTURES AND XCODE
  31. AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
  32. add_custom_command(
  33. TARGET CMakeLibTests
  34. PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
  35. )
  36. endif()
  37. foreach(test ${CMakeLib_TESTS})
  38. add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS})
  39. endforeach()
  40. if(TEST_CompileCommandOutput)
  41. add_executable(runcompilecommands run_compile_commands.cxx)
  42. target_link_libraries(runcompilecommands CMakeLib)
  43. endif()
  44. add_subdirectory(PseudoMemcheck)