Skip to content

Commit 1701775

Browse files
committed
[CMake] Hide C/C++ symbols by default
The Swift stdlib shouldn't be exposing C/C++ symbols by default. There are select functions that should be exposed, like the `_swift_allocObject` and the retain/release functions, but this should be an explicit decision in the sources.
1 parent 59d3af1 commit 1701775

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131

3232
cmake_minimum_required(VERSION 3.26...3.29)
3333

34+
set(CMAKE_C_VISIBILITY_PRESET "hidden")
35+
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
36+
3437
set(SwiftCore_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
3538
list(APPEND CMAKE_MODULE_PATH ${SwiftCore_CMAKE_MODULES_DIR})
39+
3640
include(CMakeWorkarounds)
3741
project(SwiftCore LANGUAGES C CXX Swift VERSION 6.1)
3842

0 commit comments

Comments
 (0)