Skip to content

Commit 42f5ffe

Browse files
authored
Update/Fix CMake build (#65)
Motivation: SwiftPM's CMake build (swiftlang/swift-package-manager#3202) unsuccessful even with #60. Modifications: - Use consistent `SWIFT_CRYPTO_EXPORTS` naming. In some places `CRYPTO_EXPORTS` was used instead. - Install `CCryptoBoringSSL` so we can import it in code (see swiftlang/swift-package-manager#3202) - Always set `BUILD_SHARED_LIBS` Result: Successful CMake build.
1 parent 47640ad commit 42f5ffe

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ endif()
3131
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
3232
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
3333

34-
if(CMAKE_SYSTEM_NAME STREQUAL Windows OR CMAKE_SYSTEM_NAME STREQUAL Darwin)
35-
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
36-
endif()
34+
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
3735

3836
if(BUILD_SHARED_LIBS)
3937
set(CMAKE_POSITION_INDEPENDENT_CODE YES)

cmake/modules/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
##
1313
##===----------------------------------------------------------------------===##
1414

15-
set(CRYPTO_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/CryptoExports.cmake)
16-
configure_file(CryptoConfig.cmake.in
17-
${CMAKE_CURRENT_BINARY_DIR}/CryptoConfig.cmake)
15+
set(SWIFT_CRYPTO_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/SwiftCryptoExports.cmake)
16+
configure_file(SwiftCryptoConfig.cmake.in
17+
${CMAKE_CURRENT_BINARY_DIR}/SwiftCryptoConfig.cmake)
1818

19-
get_property(CRYPTO_EXPORTS GLOBAL PROPERTY CRYPTO_EXPORTS)
20-
export(TARGETS ${CRYPTO_EXPORTS} FILE ${CRYPTO_EXPORTS_FILE})
19+
get_property(SWIFT_CRYPTO_EXPORTS GLOBAL PROPERTY SWIFT_CRYPTO_EXPORTS)
20+
export(TARGETS ${SWIFT_CRYPTO_EXPORTS} FILE ${SWIFT_CRYPTO_EXPORTS_FILE})

cmake/modules/CryptoConfig.cmake.in

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the SwiftCrypto open source project
4+
##
5+
## Copyright (c) 2021 Apple Inc. and the SwiftCrypto project authors
6+
## Licensed under Apache License v2.0
7+
##
8+
## See LICENSE.txt for license information
9+
## See CONTRIBUTORS.md for the list of SwiftCrypto project authors
10+
##
11+
## SPDX-License-Identifier: Apache-2.0
12+
##
13+
##===----------------------------------------------------------------------===##
14+
15+
if(NOT TARGET SwiftCrypto)
16+
include(@SWIFT_CRYPTO_EXPORTS_FILE@)
17+
endif()

0 commit comments

Comments
 (0)