[cmake-developers] [CMake 0012550]: frameworks with spaces breaks cmake

Mantis Bug Tracker mantis at public.kitware.com
Tue Nov 1 17:22:18 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://cmake.org/Bug/view.php?id=12550 
====================================================================== 
Reported By:                Aaron Simmons
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12550
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2011-11-01 17:22 EDT
Last Modified:              2011-11-01 17:22 EDT
====================================================================== 
Summary:                    frameworks with spaces breaks cmake
Description: 
Trying to use target_link_libraries with a framework that contains spaces (such
as the "Adobe AIR.framework" in the AIR SDK) doesn't work.


Steps to Reproduce: 
>From an unanswered email on the cmake forums
http://www.mail-archive.com/cmake@cmake.org/msg38710.html:


I'm having trouble linking my OS X application to a specific framework using
CMake without explicitly setting linker flags (somewhat defeating the
purpose of using CMake for cross-platform building).  Say I have a framework
called "My Framework.framework".  CMake successfully finds the framework
when I run:

find_library(MY_LIB \"My\ Framework\")

Then I link to my target with:

target_link_libraries(MyTarget ${MY_LIB})

The resulting linker flag is:

-Framework My Framework

This of course is incorrect and will cause gcc to try to link to "My" and
"Framework separately.

The solution is to write the linker flags myself, as follows:
set(CMAKE_EXE_LINKER_FLAGS -framework\ \"My\ Framework\")

Is there a better way?

BTW, I tried to fix up the name by replacing " " with "\ " i.e.

string(REPLACE " " "\\ " MY_LIB_FIX ${MY_LIB})

Such that MY_LIB_FIX is /Library/Frameworks/My\ Framework.framework.  But to
my dismay, CMake interprets this format differently and produces a warning
that says "[the path] is a full-path but not a valid library file name."
 The the resulting linker flag is -l rather than the required -framework.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-01 17:22 Aaron Simmons  New Issue                                    
======================================================================




More information about the cmake-developers mailing list