diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2021-05-31 17:10:45 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-06-06 17:05:28 +0200 |
commit | f777e752c6a363d802713ac4bbffdbdf48744c78 (patch) | |
tree | 5d63c6425c1f6d07c8f7cd80202944edf9b7aee8 /CMakeLists.txt | |
parent | a0709f9951324e5278b4cc7661e8be2f06bdf890 (diff) | |
download | curl-f777e752c6a363d802713ac4bbffdbdf48744c78.tar.gz |
cmake: Avoid leaking absolute paths into exported config
The `find_libarary` command resolves the library or framework
into an absolute path. In case of system frameworks which are
located within an Xcode-provided SDK this results in the Xcode
path and SDK version being part of the library path.
Because those library paths end up in the exported CMake config
importing curl will fail once the Xcode location or SDK version
changes:
```cmake
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "lber;ldap;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/SystemConfiguration.framework;OpenSSL::SSL;OpenSSL::Crypto;ZLIB::ZLIB"
)
```
A work-around is to link against system-level frameworks with
`-framework XYZ`. In case of `SystemConfiguration` we might be able
to omit the lookup-check because we could assume the framework is
always present.
Closes #7152
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f49dcf3b..b662ab18c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -385,7 +385,7 @@ if(CMAKE_USE_SECTRANSP) set(SSL_ENABLED ON) set(USE_SECTRANSP ON) - list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}") + list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework Security") endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -393,7 +393,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT SYSTEMCONFIGURATION_FRAMEWORK) message(FATAL_ERROR "SystemConfiguration framework not found") endif() - list(APPEND CURL_LIBS "${SYSTEMCONFIGURATION_FRAMEWORK}") + list(APPEND CURL_LIBS "-framework SystemConfiguration") endif() if(CMAKE_USE_OPENSSL) |