diff --git a/CMakeLists.txt b/CMakeLists.txt index 98acf968..47ff68f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries by default" YES) find_package(dispatch QUIET) find_package(Foundation QUIET) find_package(Threads QUIET) +find_package(XCTest QUIET) add_subdirectory(Sources) add_subdirectory(cmake/modules) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 18c8abd5..07b0d4d5 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(TSCclibc) add_subdirectory(TSCLibc) add_subdirectory(TSCBasic) add_subdirectory(TSCUtility) +add_subdirectory(TSCTestSupport) diff --git a/Sources/TSCBasic/CMakeLists.txt b/Sources/TSCBasic/CMakeLists.txt index d8b85eaa..d0c90550 100644 --- a/Sources/TSCBasic/CMakeLists.txt +++ b/Sources/TSCBasic/CMakeLists.txt @@ -59,8 +59,8 @@ target_link_libraries(TSCBasic PRIVATE TSCLibc) if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) if(Foundation_FOUND) - target_link_libraries(TSCBasic PUBLIC - Foundation) + target_link_directories(TSCBasic PRIVATE + $) endif() endif() target_link_libraries(TSCBasic PRIVATE diff --git a/Sources/TSCTestSupport/CMakeLists.txt b/Sources/TSCTestSupport/CMakeLists.txt new file mode 100644 index 00000000..9244472e --- /dev/null +++ b/Sources/TSCTestSupport/CMakeLists.txt @@ -0,0 +1,32 @@ +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +add_library(TSCTestSupport + AssertMatch.swift + DiagnosticsEngine.swift + FileSystemExtensions.swift + JSONExtensions.swift + misc.swift + Product.swift + PseudoTerminal.swift + XCTAssertHelpers.swift + XCTestCasePerf.swift) +target_link_libraries(TSCTestSupport PUBLIC + TSCBasic + TSCLibc + TSCUtility) +if(NOT APPLE) + if(Foundation_FOUND) + target_link_libraries(TSCTestSupport PRIVATE + Foundation) + endif() + if(XCTest_FOUND) + target_link_libraries(TSCTestSupport PRIVATE + XCTest) + endif() +endif() diff --git a/Sources/TSCUtility/CMakeLists.txt b/Sources/TSCUtility/CMakeLists.txt index 8e0a232e..109eb738 100644 --- a/Sources/TSCUtility/CMakeLists.txt +++ b/Sources/TSCUtility/CMakeLists.txt @@ -54,8 +54,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) target_link_directories(TSCUtility PRIVATE /usr/local/lib) endif() if(Foundation_FOUND) - target_link_libraries(TSCUtility PUBLIC - FoundationNetworking) + target_link_directories(TSCUtility PRIVATE + $) endif() endif() # NOTE(compnerd) workaround for CMake not setting up include flags yet