CMakeLists.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Check: a unit test framework for C
  3. #
  4. # Copyright (C) 2011 Mateusz Loskot
  5. # Copyright (C) 2001, 2002 Arien Malec
  6. #
  7. # This library is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU Lesser General Public
  9. # License as published by the Free Software Foundation; either
  10. # version 2.1 of the License, or (at your option) any later version.
  11. #
  12. # This library is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # Lesser General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public
  18. # License along with this library; if not, write to the
  19. # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. # Boston, MA 02111-1307, USA.
  21. #
  22. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
  23. # Enable finding check.h
  24. include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
  25. # For the test_vars.in script, to give the unit test shell script
  26. # runners the location of the source files
  27. set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
  28. if(WIN32)
  29. # CMake uses Unix slashes for everything, but the tests that
  30. # read srcdir expect platform specific slashes. There are two
  31. # slashes because the shell scripts will consume srcdir.
  32. string(REPLACE "/" "\\\\" srcdir "${srcdir}")
  33. set(EXEEXT ".exe")
  34. set(IS_MSVC "1")
  35. endif(WIN32)
  36. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_vars.in
  37. ${CMAKE_CURRENT_BINARY_DIR}/test_vars @ONLY)
  38. if(ENABLE_MEMORY_LEAKING_TESTS)
  39. add_definitions(-DMEMORY_LEAKING_TESTS_ENABLED=1)
  40. else(ENABLE_MEMORY_LEAKING_TESTS)
  41. add_definitions(-DMEMORY_LEAKING_TESTS_ENABLED=0)
  42. endif(ENABLE_MEMORY_LEAKING_TESTS)
  43. set(CHECK_CHECK_SOURCES
  44. check_check_exit.c
  45. check_check_fixture.c
  46. check_check_fork.c
  47. check_check_limit.c
  48. check_check_log.c
  49. check_check_log_internal.c
  50. check_check_main.c
  51. check_check_master.c
  52. check_check_msg.c
  53. check_check_pack.c
  54. check_check_selective.c
  55. check_check_sub.c
  56. check_check_tags.c
  57. check_list.c)
  58. set(CHECK_CHECK_HEADERS check_check.h)
  59. add_executable(check_check ${CHECK_CHECK_HEADERS} ${CHECK_CHECK_SOURCES})
  60. target_link_libraries(check_check check)
  61. set(CHECK_CHECK_EXPORT_SOURCES
  62. check_check_sub.c
  63. check_check_master.c
  64. check_check_log.c
  65. check_check_fork.c
  66. check_check_export_main.c
  67. )
  68. set(CHECK_CHECK_EXPORT_HEADERS check_check.h)
  69. add_executable(check_check_export
  70. ${CHECK_CHECK_EXPORT_HEADERS}
  71. ${CHECK_CHECK_EXPORT_SOURCES})
  72. target_link_libraries(check_check_export check)
  73. set(EX_OUTPUT_SOURCES ex_output.c)
  74. add_executable(ex_output ${EX_OUTPUT_SOURCES})
  75. target_link_libraries(ex_output check)
  76. set(CHECK_NOFORK_SOURCES check_nofork.c)
  77. add_executable(check_nofork ${CHECK_NOFORK_SOURCES})
  78. target_link_libraries(check_nofork check)
  79. set(CHECK_NOFORK_TEARDOWN_SOURCES check_nofork_teardown.c)
  80. add_executable(check_nofork_teardown ${CHECK_NOFORK_TEARDOWN_SOURCES})
  81. target_link_libraries(check_nofork_teardown check)
  82. set(CHECK_SET_MAX_MSG_SIZE_SOURCES check_set_max_msg_size.c)
  83. add_executable(check_set_max_msg_size ${CHECK_SET_MAX_MSG_SIZE_SOURCES})
  84. target_link_libraries(check_set_max_msg_size check)
  85. set(CHECK_MEM_LEAKS_SOURCES
  86. check_mem_leaks.c
  87. check_check_log.c
  88. check_check_limit.c
  89. check_check_fixture.c
  90. check_check_fork.c
  91. check_check_exit.c
  92. check_check_selective.c
  93. check_check_sub.c
  94. check_check_master.c
  95. check_check_tags.c
  96. )
  97. add_executable(check_mem_leaks ${CHECK_MEM_LEAKS_SOURCES})
  98. target_link_libraries(check_mem_leaks check)