From aa0271bd6ac1a069a1f1410cbda1b0a73050ac6a Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 3 Apr 2024 13:35:48 -0700 Subject: [PATCH 1/2] Suppress needlessly alarming messages These packages are not marked `REQUIRED` and when this project is used as a dependency of another CMake project they don't need to be findable when this CMakeLists.txt is read. They may in fact be found later in the configuration process, so the messages when they actually _are_ needed, so the messages ``` -- Could NOT find dispatch (missing: dispatch_DIR) -- Could NOT find Foundation (missing: Foundation_DIR) -- Could NOT find XCTest (missing: XCTest_DIR) ``` are needlessly alarming. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cad3a235..18416725 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,9 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) include(CTest) include(SwiftSupport) -find_package(dispatch CONFIG) -find_package(Foundation CONFIG) -find_package(XCTest CONFIG) +find_package(dispatch QUIET CONFIG) +find_package(Foundation QUIET CONFIG) +find_package(XCTest QUIET CONFIG) add_subdirectory(Sources) if(BUILD_EXAMPLES) From 49133c95d4bbda5e0bb4b90b80410779b6f22667 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 27 Sep 2024 11:54:05 -0700 Subject: [PATCH 2/2] Take @compnerd's suggestion Co-authored-by: Saleem Abdulrasool --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18416725..583ac2f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,13 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) include(CTest) include(SwiftSupport) -find_package(dispatch QUIET CONFIG) -find_package(Foundation QUIET CONFIG) -find_package(XCTest QUIET CONFIG) +if(NOT APPLE) + find_package(dispatch CONFIG) + find_package(Foundation CONFIG) + if(BUILD_TESTING) + find_package(XCTest CONFIG) + endif() +endif() add_subdirectory(Sources) if(BUILD_EXAMPLES)