CMakeLists.txt 1.3 KB

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