#[[
This source file is part of the Swift Atomics Open Source Project

Copyright (c) 2021 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
#]]

if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
  find_package(dispatch CONFIG)
  find_package(Foundation CONFIG)
endif()
find_package(XCTest CONFIG)

add_executable(AtomicsTestBundle
  AtomicsTests/main.swift
  AtomicsTests/autogenerated/Basics.swift
  AtomicsTests/DoubleWord.swift
  AtomicsTests/LifetimeTracked.swift
  AtomicsTests/LockFreeQueue.swift
  AtomicsTests/LockFreeSingleConsumerStack.swift
  AtomicsTests/StrongReferenceRace.swift
  AtomicsTests/StrongReferenceShuffle.swift
  AtomicsTests/UnsafeAtomicLazyReference.swift)
target_link_libraries(AtomicsTestBundle PRIVATE
  Atomics
  XCTest
  $<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
  $<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)

add_test(NAME SwiftAtomics
  COMMAND AtomicsTestBundle)
