Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS CMake install(targets ...) function uses wrong folders

Tags:

ios

cmake

When using the iOS.cmake toolchain (located here https://code.google.com/p/ios-cmake/) my build folders are changed from Debug and Release to Debug-iphoneos and Release-iphoneos.

This isn't an issue except when I try running the code below:

install(TARGETS ${PROJECT_NAME} 
        RUNTIME DESTINATION bin COMPONENT development
        ARCHIVE DESTINATION lib COMPONENT development 
        LIBRARY DESTINATION ${MYPROJECT_LIB_SUBDIR} COMPONENT development NAMELINK_SKIP)
install(TARGETS ${PROJECT_NAME} 
        RUNTIME DESTINATION bin COMPONENT runtime
        ARCHIVE DESTINATION lib COMPONENT source 
        LIBRARY DESTINATION ${MYPROJECT_LIB_SUBDIR} COMPONENT source NAMELINK_SKIP)

This code gives me the following errors:

-- Install configuration: "Release"
-- Install component: "development"
CMake Error at cmake_install.cmake:54 (FILE):
  file INSTALL cannot find
  "/Users/username/Documents/Projects/MyFramework/src/ios-build/MyProject/Release/libMyProject.a".

-- Install configuration: "Debug"
-- Install component: "development"
CMake Error at cmake_install.cmake:48 (FILE):
  file INSTALL cannot find
  "/Users/username/Documents/Projects/MyFramework/src/ios-build/MyProject/Debug/libMyProjectd.a".

For some reason the install(targets ...) function is looking for folders named Debug and Release instead of Debug-iphoneos and Release-iphoneos.

So I either need to make sure that install(targets ...) is looking in the correct folders for the archive or I need to prevent iOS.cmake from renaming the Debug and Release folders. Can anyone suggest anything for this?

Edit

Looks like this is an issue with CMake as identified here: http://public.kitware.com/Bug/view.php?id=9117

I tried updating to the latest version of CMake to see if this had been fixed and I'm still getting the same error. I see a patch attached to the bug report but I'm not sure how to apply it or what I can do to fix this issue.

like image 953
robhasacamera Avatar asked Sep 09 '13 14:09

robhasacamera


1 Answers

Found a more specific report of this issue here: http://public.kitware.com/Bug/view.php?id=12506

There are a couple of workarounds on that site. However I used the code snippet below instead to create the Release and Debug folders in the same directory without appending the EFFECTIVE_PLATFORM_NAME to them.

if(${IOS})
  set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
endif(${IOS})
like image 173
robhasacamera Avatar answered Sep 28 '22 04:09

robhasacamera