The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

63 lines
1.9 KiB

2 months ago
  1. find_package(Threads REQUIRED)
  2. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
  3. set(BUILD_MOCK ON CACHE BOOL "" FORCE)
  4. set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
  5. if(YAML_USE_SYSTEM_GTEST)
  6. find_package(GTest)
  7. if (NOT GTEST_FOUND)
  8. message(FATAL_ERROR "system googletest was requested but not found")
  9. endif()
  10. else()
  11. add_subdirectory(
  12. "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0"
  13. "${CMAKE_CURRENT_BINARY_DIR}/prefix")
  14. include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0/googletest/include")
  15. endif()
  16. set(test-new-api-pattern "new-api/*.cpp")
  17. set(test-source-pattern "*.cpp" "integration/*.cpp" "node/*.cpp")
  18. if (CMAKE_VERSION VERSION_GREATER 3.11)
  19. list(INSERT test-new-api-pattern 0 CONFIGURE_DEPENDS)
  20. list(INSERT test-source-pattern 0 CONFIGURE_DEPENDS)
  21. endif()
  22. file(GLOB test-new-api-sources ${test-new-api-pattern})
  23. file(GLOB test-sources ${test-source-pattern})
  24. add_executable(yaml-cpp-tests "")
  25. target_sources(yaml-cpp-tests
  26. PRIVATE
  27. ${test-new-api-sources}
  28. ${test-sources})
  29. target_include_directories(yaml-cpp-tests
  30. PRIVATE
  31. ${CMAKE_CURRENT_SOURCE_DIR}/integration
  32. ${CMAKE_CURRENT_SOURCE_DIR}
  33. ${PROJECT_SOURCE_DIR}/src)
  34. target_compile_options(yaml-cpp-tests
  35. PRIVATE
  36. $<$<CXX_COMPILER_ID:Clang>:-Wno-c99-extensions -Wno-variadic-macros -Wno-sign-compare>
  37. $<$<CXX_COMPILER_ID:GNU>:-Wno-variadic-macros -Wno-sign-compare -Wno-narrowing>)
  38. target_link_libraries(yaml-cpp-tests
  39. PRIVATE
  40. Threads::Threads
  41. yaml-cpp
  42. gtest
  43. gmock)
  44. set_property(TARGET yaml-cpp-tests PROPERTY CXX_STANDARD_REQUIRED ON)
  45. if (NOT DEFINED CMAKE_CXX_STANDARD)
  46. set_target_properties(yaml-cpp-tests PROPERTIES CXX_STANDARD 11)
  47. endif()
  48. add_test(NAME yaml-cpp::test COMMAND yaml-cpp-tests)
  49. if (build-windows-dll)
  50. add_custom_command(
  51. TARGET yaml-cpp-tests
  52. POST_BUILD COMMAND ${CMAKE_COMMAND} -E
  53. copy_if_different "$<TARGET_FILE:yaml-cpp>" "$<TARGET_FILE_DIR:yaml-cpp-tests>")
  54. endif()