MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0014105 | CMake | CMake | public | 2013-04-22 11:04 | 2013-10-07 10:09 |
Reporter | Stephen Kelly | ||||
Assigned To | Stephen Kelly | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | Apple Mac | OS | OSX | OS Version | |
Product Version | CMake 2.8.10.2 | ||||
Target Version | Fixed in Version | ||||
Summary | 0014105: IMPORTED target for a framework not handled correctly. | ||||
Description | Given this: cmake_minimum_required(VERSION 2.8) project(cmake_framework_target) find_library(COCOA_LIBRARY Cocoa) add_library(Custom::Cocoa IMPORTED SHARED) set_property(TARGET Custom::Cocoa APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET Custom::Cocoa PROPERTY IMPORTED_LOCATION_RELEASE "${COCOA_LIBRARY}") set_property(TARGET Custom::Cocoa PROPERTY FRAMEWORK 1) add_executable(Framework_test main.cpp) #target_link_libraries(Framework_test ${COCOA_LIBRARY}) target_link_libraries(Framework_test Custom::Cocoa) Using the COCOA_LIBRARY in the tll() line works fine, linking is done with -framework Cocoa. However, using the IMPORTED target, cmake links with this result: Linking CXX executable Framework_test /Users/kdab/dev/cmake/build/bin/cmake -E cmake_link_script CMakeFiles/Framework_test.dir/link.txt --verbose=1 /usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Framework_test.dir/main.cpp.o -o Framework_test /System/Library/Frameworks/Cocoa.framework ld: in /System/Library/Frameworks/Cocoa.framework, can't map file, errno=22 for architecture x86_64 collect2: ld returned 1 exit status This patch fixes the issue, but I have no idea if it is appropriate (because I don't have any familiarity with Mac, or how frameworks are supposed to work, or if it is appropriate to create an imported target for a framework at all in cmake): diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 896b50a..4fd32ea 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -657,14 +657,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) // Pass the full path to the target file. std::string lib = tgt->GetFullPath(config, implib, true); - if(!this->LinkDependsNoShared || - tgt->GetType() != cmTarget::SHARED_LIBRARY) + if(cmSystemTools::FileIsDirectory(lib.c_str())) { - this->Depends.push_back(lib); + this->AddDirectoryItem(lib); } + else + { + if(!this->LinkDependsNoShared || + tgt->GetType() != cmTarget::SHARED_LIBRARY) + { + this->Depends.push_back(lib); + } - this->AddTargetItem(lib, tgt); - this->AddLibraryRuntimeInfo(lib, tgt); + this->AddTargetItem(lib, tgt); + this->AddLibraryRuntimeInfo(lib, tgt); + } } } else | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2013-04-22 11:04 | Stephen Kelly | New Issue | |||
2013-04-22 11:17 | Brad King | Note Added: 0032918 | |||
2013-04-22 11:28 | Stephen Kelly | Note Added: 0032919 | |||
2013-04-22 11:34 | Brad King | Note Added: 0032920 | |||
2013-04-22 11:38 | Stephen Kelly | Note Added: 0032921 | |||
2013-04-22 11:38 | Stephen Kelly | Status | new => resolved | ||
2013-04-22 11:38 | Stephen Kelly | Resolution | open => no change required | ||
2013-04-22 11:38 | Stephen Kelly | Assigned To | => Stephen Kelly | ||
2013-10-07 10:09 | Robert Maynard | Note Added: 0034036 | |||
2013-10-07 10:09 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|