MantisBT - CMake
View Issue Details
0014191CMakeCMakepublic2013-06-03 21:562013-11-04 09:33
Edward Rudd 
Brad King 
normalmajoralways
closedfixed 
CMake 2.8.11 
CMake 2.8.11.1CMake 2.8.11.1 
0014191: Regression.. framework paths are not added to compile args in XCode generator
I have a cmake that has lines like this to find private framework

    FIND_LIBRARY(SDL2_LIBRARY SDL2
        PATHS ${CommonRoot}/SDL2/lib/osx
        NO_DEFAULT_PATH)

and then later for a add_library target does this to add the framework path into the build

    TARGET_LINK_LIBRARIES(MyLIB ${SDL2_LIBRARY})

with 2.8.10 this would add a -F/path/to/SDL2/lib/osx argument to GCC/G++. However in 2.8.11 this does not happen and compiles fail due to gcc' not being able to find the frameworks for fetching the headers inside of them (e.g. <SDL2/SDL.h> )

if I use the Make generator it works fine and continues to add in the -F parameter.
No tags attached.
related to 0013397closed Brad King frameworks are not transitive like libraries in the project dependency graph 
Issue History
2013-06-03 21:56Edward RuddNew Issue
2013-06-03 22:25Edward RuddNote Added: 0033218
2013-06-03 22:25Edward RuddNote Edited: 0033218bug_revision_view_page.php?bugnote_id=33218#r1176
2013-06-04 08:33Brad KingRelationship addedrelated to 0013397
2013-06-04 09:00Brad KingNote Added: 0033225
2013-06-04 09:07Edward RuddNote Added: 0033226
2013-06-04 09:15Brad KingNote Added: 0033227
2013-06-04 09:18Edward RuddNote Added: 0033229
2013-06-04 09:44Brad KingNote Added: 0033232
2013-06-04 09:45Brad KingAssigned To => Brad King
2013-06-04 09:45Brad KingStatusnew => assigned
2013-06-04 09:45Brad KingTarget Version => CMake 2.8.12
2013-06-04 10:15Edward RuddNote Added: 0033233
2013-06-04 10:22Brad KingNote Added: 0033235
2013-06-04 10:58Brad KingNote Added: 0033237
2013-06-04 10:58Brad KingStatusassigned => resolved
2013-06-04 10:58Brad KingResolutionopen => fixed
2013-06-04 10:58Brad KingFixed in Version => CMake 2.8.12
2013-06-07 15:16Robert MaynardFixed in VersionCMake 2.8.12 => CMake 2.8.11.1
2013-06-07 15:16Robert MaynardTarget VersionCMake 2.8.12 => CMake 2.8.11.1
2013-11-04 09:33Robert MaynardNote Added: 0034368
2013-11-04 09:33Robert MaynardStatusresolved => closed

Notes
(0033218)
Edward Rudd   
2013-06-03 22:25   
It looks like the culprit commit is 2bc22bdaacfc0f0f91c229685dc5dbadd0267601 that broke it.


After that the Target specific FRAMEWORK_SEARCH_PATHS don't work in Xcode projects.

I'll do more git bisecting tomorrow to be sure..

(0033225)
Brad King   
2013-06-04 09:00   
I cannot reproduce this. I constructed a test case with the code

 add_executable(foo foo.c)
 target_link_libraries(foo ${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/OpenGL2.framework)

where "OpenGL2.framework" was created by copying the OpenGL.framework and renaming it. The foo.c source does #include <OpenGL2/gl.h> and it works with the Xcode generator in CMake 2.8.10 and 2.8.11. The -F option shows up on the compile line. Only if I manually remove it does the compilation fail.
(0033226)
Edward Rudd   
2013-06-04 09:07   
You are adding it to the executable.. I am not adding it to an executable target but a library target.

try this.

add_library(bar bar.c)
target_link_libraries(bar ${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/OpenGL2.framework)

add_executable(foo foo.c)
target_link_libraries(foo bar)
(0033227)
Brad King   
2013-06-04 09:15   
Ahh, more specifically it is a STATIC library target that fails. This works:

 add_library(foo SHARED foo.c)
 target_link_libraries(foo ${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/OpenGL2.framework)

but this fails:

 add_library(foo STATIC foo.c)
 target_link_libraries(foo ${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/OpenGL2.framework)
(0033229)
Edward Rudd   
2013-06-04 09:18   
Correct, sorry I forgot that detail..
(0033232)
Brad King   
2013-06-04 09:44   
The commit you reported from git bisect:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bc22bda [^]

makes it pretty clear what is wrong:

+ if(target.GetType() != cmTarget::OBJECT_LIBRARY &&
+ target.GetType() != cmTarget::STATIC_LIBRARY)
     {
...
+ // Add framework search paths needed for linking.

I added that because those library types do not actually link but forgot about the influence of FRAMEWORK_SEARCH_PATHS on the compile line.
(0033233)
Edward Rudd   
2013-06-04 10:15   
Sweet.. so it should be a simple fix..
(0033235)
Brad King   
2013-06-04 10:22   
Re 0014191:0033233: Yes, I'm running the test suite with the fix now.
(0033237)
Brad King   
2013-06-04 10:58   
Fixed:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21a0beac [^]
(0034368)
Robert Maynard   
2013-11-04 09:33   
Closing resolved issues that have not been updated in more than 4 months.