CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #
  2. # Testing
  3. #
  4. PROJECT (Testing)
  5. #
  6. # Lib and exe path
  7. #
  8. SET (LIBRARY_OUTPUT_PATH
  9. ${Testing_BINARY_DIR}/bin/ CACHE PATH
  10. "Single output directory for building all libraries.")
  11. SET (EXECUTABLE_OUTPUT_PATH
  12. ${Testing_BINARY_DIR}/bin/ CACHE PATH
  13. "Single output directory for building all executables.")
  14. #
  15. # Where will executable tests be written ?
  16. #
  17. IF (EXECUTABLE_OUTPUT_PATH)
  18. SET (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
  19. ELSE (EXECUTABLE_OUTPUT_PATH)
  20. SET (CXX_TEST_PATH .)
  21. ENDIF (EXECUTABLE_OUTPUT_PATH)
  22. #
  23. # Link to CMake lib
  24. #
  25. FIND_LIBRARY(CMAKE_LIB
  26. CMakeLib
  27. ${Testing_BINARY_DIR}/../../Source
  28. ${Testing_BINARY_DIR}/../../Source/Debug
  29. ${Testing_BINARY_DIR}/../../Source/Release
  30. ${Testing_BINARY_DIR}/../../Source/MinSizeRel
  31. ${Testing_BINARY_DIR}/../../Source/RelWithDebInfo)
  32. # Specify the same one for debug/optimized to increase coverage
  33. LINK_LIBRARIES(${CMAKE_LIB}
  34. debug ${CMAKE_LIB}
  35. optimized ${CMAKE_LIB})
  36. #
  37. # Include Dart
  38. # (will also set NSLOOKUP, HOSTNAME, etc.)
  39. #
  40. INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
  41. #
  42. # Extra coverage
  43. #
  44. BUILD_COMMAND(BUILD_COMMAND_VAR ${CMAKE_MAKE_PROGRAM})
  45. BUILD_NAME(BUILD_NAME_VAR)
  46. SITE_NAME(SITE_NAME_VAR)
  47. #
  48. # Enable testing
  49. #
  50. ENABLE_TESTING()
  51. #
  52. # Add test
  53. #
  54. ADD_EXECUTABLE(testing testing.cxx)
  55. ADD_TEST(testing ${Testing_BINARY_DIR}/bin/testing)
  56. #
  57. # Force subdirs
  58. # (coverage)
  59. #
  60. SUBDIRS(Sub/Sub2)