diff options
author | Brad King <brad.king@kitware.com> | 2011-11-02 12:58:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-11-02 12:58:41 (GMT) |
commit | e74f3744ae25b5be2bf6e4c33a0420d836a2f37d (patch) | |
tree | b7638df3c6bd034d081e69b43cbe87ee70a7fc1f | |
parent | d4afce1ddd0a5f8c5bdc5b59d24344d61016aa99 (diff) | |
download | CMake-e74f3744ae25b5be2bf6e4c33a0420d836a2f37d.zip CMake-e74f3744ae25b5be2bf6e4c33a0420d836a2f37d.tar.gz CMake-e74f3744ae25b5be2bf6e4c33a0420d836a2f37d.tar.bz2 |
Fix linking to OS X Frameworks named with spaces (#12550)
Teach cmComputeLinkInformation to generate the "-framework" option as a
separate link item preceding the actual framework name. Then escape the
framework name to pass as an argument through a shell. This fixes the
link line for frameworks with spaces in the name.
The build system generators that call cli.GetItems() and generate the
final list of items on the link line already handle escaping correctly
for items that are paths. However, for raw link items like "-lfoo" they
just pass through to the command line verbatim. This is incorrect. The
generators should escape these items too. Unfortunately we cannot fix
that without introducing a new CMake Policy because projects may already
be passing raw link flags with their own escapes to work around this
bug. Therefore we punt on this bug for now and go with the above fix.
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c87b64d..f8ab686 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1318,8 +1318,9 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) this->AddFrameworkPath(this->SplitFramework.match(1)); // Add the item using the -framework option. - std::string fw = "-framework "; - fw += this->SplitFramework.match(2); + this->Items.push_back(Item("-framework", false)); + std::string fw = this->SplitFramework.match(2); + fw = this->LocalGenerator->EscapeForShell(fw.c_str()); this->Items.push_back(Item(fw, false)); } |