#[[
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) # FIXME Hook this up on Darwin
  find_package(dispatch CONFIG)
  find_package(Foundation CONFIG)
  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_compile_definitions(AtomicsTestBundle PUBLIC
    ENABLE_DOUBLEWIDE_ATOMICS)

  target_link_libraries(AtomicsTestBundle PRIVATE
    Atomics
    XCTest
    dispatch
    Foundation)
  
  add_test(NAME SwiftAtomics
    COMMAND AtomicsTestBundle)
endif()
