How to generate xcode project of static libs for iOS using Cmake?

I am trying to create an Xcode ASSIMP project using Cmake. I know that there is already one in the workspace folder. And I'm just trying to generate myself. I tried to write cmakelist.txt:

cmake_minimum_required(VERSION 2.8) project(assimp) set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator") set(CMAKE_OSX_SYSROOT iphoneos5.1) set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) add_subdirectory(assimp) 

then I ran the following command:

 #!/bin/bash cd "$(dirname "$0")"/assimp if [ ! -d xcode ] then mkdir xcode fi cd xcode cmake -G Xcode ../.. -DINSTALL_LIBS=ON -DCMAKE_INSTALL_PREFIX=../.. -DBUILD_SHARED_LIBS=OFF -DBUILD_ASSIMP_TOOLS:BOOL=OFF -DENABLE_BOOST_WORKAROUND=ON # Device or simulator xcodebuild -target install -configuration Release 

it generates an Xcode project, but in libassimp.dylib products and gets "target indicates the product type is com.apple.product-type.library.dynamic", but there is no such type of product for the iphoneos platform, an error.

How to change "com.apple.product-type.library.dynamic" to static? I set -DBUILD_SHARED_LIBS = OFF, but that did not work.

I searched the Internet and cannot find the cause of the problem.

Thanks so much for any help!

+4
source share
1 answer

in cmakelist.txt in the / code / directory there is a line: ADD_LIBRARY (assimp SHARED will just change SHARED to STATIC

cmakelist which I use:

 cmake_minimum_required(VERSION 2.8.6) project(assimp) # Set the Base SDK (only change the SDKVER value, if for instance, you are building for iOS 5.0): set(SDKVER "5.1") set(DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer") set(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk") if(EXISTS ${SDKROOT}) set(CMAKE_OSX_SYSROOT "${SDKROOT}") else() message("Warning, iOS Base SDK path not found: " ${SDKROOT}) endif() # Will resolve to "Standard (armv6 armv7)" on Xcode 4.0.2 and to "Standard (armv7)" on Xcode 4.2: set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)") # seamless toggle between device and simulator set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_subdirectory(assimp) 
+9
source

Source: https://habr.com/ru/post/1411723/


All Articles