2020-03-23 21:44:29 +08:00
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
2023-01-02 20:51:48 +08:00
|
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
2016-09-04 18:37:46 +08:00
|
|
|
# SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
#
|
2020-03-23 21:44:29 +08:00
|
|
|
###########################################################################
|
2024-08-21 13:59:27 +08:00
|
|
|
option(CURL_HIDDEN_SYMBOLS "Hide libcurl internal symbols (=hide all symbols that are not officially external)" ON)
|
2016-09-04 18:37:46 +08:00
|
|
|
mark_as_advanced(CURL_HIDDEN_SYMBOLS)
|
|
|
|
|
2024-05-20 20:21:05 +08:00
|
|
|
if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
|
|
|
|
# We need to export internal debug functions,
|
|
|
|
# e.g. curl_easy_perform_ev() or curl_dbg_*(),
|
|
|
|
# so disable symbol hiding for debug builds and for memory tracking.
|
2023-09-22 18:18:26 +08:00
|
|
|
set(CURL_HIDDEN_SYMBOLS OFF)
|
|
|
|
endif()
|
|
|
|
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS FALSE)
|
|
|
|
unset(CURL_EXTERN_SYMBOL)
|
|
|
|
unset(CURL_CFLAG_SYMBOLS_HIDE)
|
2016-09-04 18:37:46 +08:00
|
|
|
|
2024-10-24 18:15:44 +08:00
|
|
|
if(CURL_HIDDEN_SYMBOLS)
|
2020-11-10 17:30:29 +08:00
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC)
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
|
2024-10-26 06:23:19 +08:00
|
|
|
set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
2018-07-17 14:36:59 +08:00
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
2020-02-24 20:34:54 +08:00
|
|
|
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
2024-07-13 03:10:57 +08:00
|
|
|
# Note: This is considered buggy prior to 4.0 but the autotools do not care, so let us ignore that fact
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
|
2024-10-26 06:23:19 +08:00
|
|
|
set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
2016-09-04 18:37:46 +08:00
|
|
|
endif()
|
2018-07-17 14:36:59 +08:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
|
|
|
|
set(CURL_EXTERN_SYMBOL "__global")
|
|
|
|
set(CURL_CFLAG_SYMBOLS_HIDE "-xldscope=hidden")
|
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) # Requires 9.1.045
|
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
|
2024-10-26 06:23:19 +08:00
|
|
|
set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
2018-07-17 14:36:59 +08:00
|
|
|
elseif(MSVC)
|
2024-10-24 18:15:44 +08:00
|
|
|
set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
|
2018-07-17 14:36:59 +08:00
|
|
|
endif()
|
2019-07-09 22:03:06 +08:00
|
|
|
else()
|
2024-08-08 06:53:38 +08:00
|
|
|
if(MSVC)
|
2024-10-25 16:47:25 +08:00
|
|
|
# Note: This option is prone to export non-curl extra symbols.
|
2024-08-08 06:53:38 +08:00
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
|
|
|
endif()
|
2016-09-04 18:37:46 +08:00
|
|
|
endif()
|