CMakeLists.txt 1.4 KB

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