From b0402d3a15922f3417d65739291114199e5cf815 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 7 Jul 2021 15:06:36 -0700 Subject: [PATCH 1/2] =?UTF-8?q?[CMake]=20swift-collections=20=E2=86=92=20S?= =?UTF-8?q?wiftCollections?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an integration FIXME for SwiftPM: https://github.com/apple/swift-package-manager/pull/3595#issuecomment-875201764 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 064f063e0..d79e19086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ See https://swift.org/LICENSE.txt for license information #]] cmake_minimum_required(VERSION 3.16) -project(swift-collections +project(SwiftCollections LANGUAGES C Swift) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) From 175e1eb6b3395e3808218e72910235658819bdc5 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 7 Jul 2021 18:27:53 -0700 Subject: [PATCH 2/2] [CMake] Generate exports under cmake/modules/SwiftCollectionsConfig.cmake --- CMakeLists.txt | 7 +------ cmake/modules/CMakeLists.txt | 19 +++++++++++++++++++ cmake/modules/SwiftCollectionsConfig.cmake.in | 12 ++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 cmake/modules/CMakeLists.txt create mode 100644 cmake/modules/SwiftCollectionsConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index d79e19086..efb367756 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,9 +29,4 @@ add_subdirectory(Sources) # if(BUILD_TESTING) # add_subdirectory(Tests) # endif() - -get_property(SWIFT_COLLECTIONS_EXPORTS GLOBAL PROPERTY SWIFT_COLLECTIONS_EXPORTS) -export(TARGETS ${SWIFT_COLLECTIONS_EXPORTS} - NAMESPACE SwiftCollections:: - FILE swift-collections-config.cmake - EXPORT_LINK_INTERFACE_LIBRARIES) +add_subdirectory(cmake/modules) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 000000000..e07591af3 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,19 @@ +#[[ +This source file is part of the Swift Collections 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 +#]] + +set(SWIFT_COLLECTIONS_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/SwiftCollectionsExports.cmake) + +configure_file(SwiftCollectionsConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/SwiftCollectionsConfig.cmake) + +get_property(SWIFT_COLLECTIONS_EXPORTS GLOBAL PROPERTY SWIFT_COLLECTIONS_EXPORTS) +export(TARGETS ${SWIFT_COLLECTIONS_EXPORTS} + NAMESPACE SwiftCollections:: + FILE ${SWIFT_COLLECTIONS_EXPORTS_FILE} + EXPORT_LINK_INTERFACE_LIBRARIES) diff --git a/cmake/modules/SwiftCollectionsConfig.cmake.in b/cmake/modules/SwiftCollectionsConfig.cmake.in new file mode 100644 index 000000000..3343244d9 --- /dev/null +++ b/cmake/modules/SwiftCollectionsConfig.cmake.in @@ -0,0 +1,12 @@ +#[[ +This source file is part of the Swift Collections 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 TARGET SwiftCollections) + include(@SWIFT_COLLECTIONS_EXPORTS_FILE@) +endif()