Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Update config to prepare for SwiftPM adoption #60

Merged
merged 2 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
19 changes: 19 additions & 0 deletions cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions cmake/modules/SwiftCollectionsConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -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()