multiarch / crossbuild

:earth_africa: multiarch cross compiling environments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CoreFoundation lib not found

rokups opened this issue · comments

Hello,
I got project with following cmake code:

  find_library(CORE_FOUNDATION CoreFoundation)
  if(NOT CORE_FOUNDATION)
    message(FATAL_ERROR "Apple Core Foundation framework not found!")
  endif()

Attempt to build it with either CROSS_TRIPLE=i386-apple-darwin or CROSS_TRIPLE=x86_64-apple-darwin results in the error about missing lib. I failed to find any extra instructions on the matter. Is there a need to do some extra setup to provide these libs myself or is this a bug?

I managed to solve this with following CMake toolchain file:

set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_VERSION 10.9)
set(CMAKE_FIND_ROOT_PATH $ENV{CROSS_ROOT})
set(CMAKE_C_COMPILER cc)
set(CMAKE_CXX_COMPILER c++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST)
set(CMAKE_FIND_FRAMEWORK FIRST)

set(CMAKE_OSX_SYSROOT_PATH /usr/osxcross/SDK/MacOSX10.10.sdk)
set(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_PATH})
list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
    ${CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks
    ${CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks
    ${CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
)