1*6236dae4SAndroid Build Coastguard Worker#*************************************************************************** 2*6236dae4SAndroid Build Coastguard Worker# _ _ ____ _ 3*6236dae4SAndroid Build Coastguard Worker# Project ___| | | | _ \| | 4*6236dae4SAndroid Build Coastguard Worker# / __| | | | |_) | | 5*6236dae4SAndroid Build Coastguard Worker# | (__| |_| | _ <| |___ 6*6236dae4SAndroid Build Coastguard Worker# \___|\___/|_| \_\_____| 7*6236dae4SAndroid Build Coastguard Worker# 8*6236dae4SAndroid Build Coastguard Worker# Copyright (C) Daniel Stenberg, <[email protected]>, et al. 9*6236dae4SAndroid Build Coastguard Worker# 10*6236dae4SAndroid Build Coastguard Worker# This software is licensed as described in the file COPYING, which 11*6236dae4SAndroid Build Coastguard Worker# you should have received as part of this distribution. The terms 12*6236dae4SAndroid Build Coastguard Worker# are also available at https://curl.se/docs/copyright.html. 13*6236dae4SAndroid Build Coastguard Worker# 14*6236dae4SAndroid Build Coastguard Worker# You may opt to use, copy, modify, merge, publish, distribute and/or sell 15*6236dae4SAndroid Build Coastguard Worker# copies of the Software, and permit persons to whom the Software is 16*6236dae4SAndroid Build Coastguard Worker# furnished to do so, under the terms of the COPYING file. 17*6236dae4SAndroid Build Coastguard Worker# 18*6236dae4SAndroid Build Coastguard Worker# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19*6236dae4SAndroid Build Coastguard Worker# KIND, either express or implied. 20*6236dae4SAndroid Build Coastguard Worker# 21*6236dae4SAndroid Build Coastguard Worker# SPDX-License-Identifier: curl 22*6236dae4SAndroid Build Coastguard Worker# 23*6236dae4SAndroid Build Coastguard Worker########################################################################### 24*6236dae4SAndroid Build Coastguard Workeroption(CURL_HIDDEN_SYMBOLS "Hide libcurl internal symbols (=hide all symbols that are not officially external)" ON) 25*6236dae4SAndroid Build Coastguard Workermark_as_advanced(CURL_HIDDEN_SYMBOLS) 26*6236dae4SAndroid Build Coastguard Worker 27*6236dae4SAndroid Build Coastguard Workerif(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG)) 28*6236dae4SAndroid Build Coastguard Worker # We need to export internal debug functions, 29*6236dae4SAndroid Build Coastguard Worker # e.g. curl_easy_perform_ev() or curl_dbg_*(), 30*6236dae4SAndroid Build Coastguard Worker # so disable symbol hiding for debug builds and for memory tracking. 31*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDDEN_SYMBOLS OFF) 32*6236dae4SAndroid Build Coastguard Workerendif() 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard Workerset(CURL_HIDES_PRIVATE_SYMBOLS FALSE) 35*6236dae4SAndroid Build Coastguard Workerunset(CURL_EXTERN_SYMBOL) 36*6236dae4SAndroid Build Coastguard Workerunset(CURL_CFLAG_SYMBOLS_HIDE) 37*6236dae4SAndroid Build Coastguard Worker 38*6236dae4SAndroid Build Coastguard Workerif(CURL_HIDDEN_SYMBOLS) 39*6236dae4SAndroid Build Coastguard Worker if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC) 40*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDES_PRIVATE_SYMBOLS TRUE) 41*6236dae4SAndroid Build Coastguard Worker set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))") 42*6236dae4SAndroid Build Coastguard Worker set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") 43*6236dae4SAndroid Build Coastguard Worker elseif(CMAKE_COMPILER_IS_GNUCC) 44*6236dae4SAndroid Build Coastguard Worker if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) 45*6236dae4SAndroid Build Coastguard Worker # Note: This is considered buggy prior to 4.0 but the autotools do not care, so let us ignore that fact 46*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDES_PRIVATE_SYMBOLS TRUE) 47*6236dae4SAndroid Build Coastguard Worker set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))") 48*6236dae4SAndroid Build Coastguard Worker set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") 49*6236dae4SAndroid Build Coastguard Worker endif() 50*6236dae4SAndroid Build Coastguard Worker elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) 51*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDES_PRIVATE_SYMBOLS TRUE) 52*6236dae4SAndroid Build Coastguard Worker set(CURL_EXTERN_SYMBOL "__global") 53*6236dae4SAndroid Build Coastguard Worker set(CURL_CFLAG_SYMBOLS_HIDE "-xldscope=hidden") 54*6236dae4SAndroid Build Coastguard Worker elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) # Requires 9.1.045 55*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDES_PRIVATE_SYMBOLS TRUE) 56*6236dae4SAndroid Build Coastguard Worker set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))") 57*6236dae4SAndroid Build Coastguard Worker set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") 58*6236dae4SAndroid Build Coastguard Worker elseif(MSVC) 59*6236dae4SAndroid Build Coastguard Worker set(CURL_HIDES_PRIVATE_SYMBOLS TRUE) 60*6236dae4SAndroid Build Coastguard Worker endif() 61*6236dae4SAndroid Build Coastguard Workerelse() 62*6236dae4SAndroid Build Coastguard Worker if(MSVC) 63*6236dae4SAndroid Build Coastguard Worker # Note: This option is prone to export non-curl extra symbols. 64*6236dae4SAndroid Build Coastguard Worker set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) 65*6236dae4SAndroid Build Coastguard Worker endif() 66*6236dae4SAndroid Build Coastguard Workerendif() 67