# Sample toolchain file for building for Mac OS X from an Ubuntu Linux system. # # Typical usage: # *) install cross compiler from https://github.com/tpoechtrager/osxcross # *) mkdir build # *) cd build # *) cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/ubuntu-osxcross-9.7.cmake .. set(CMAKE_SYSTEM_NAME Darwin) set(TOOLCHAIN_PREFIX x86_64-apple-darwin15) # cross compilers to use for C and C++ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-clang) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-clang++) set(ENV{PKG_CONFIG_PATH} /home/mollekopf/osxcross/osxcross/target/macports/pkgs/opt/local/lib/pkgconfig) # target environment on the build host system # set 1st to dir with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH /home/mollekopf/osxcross/osxcross/target/macports/pkgs/opt/local/libexec/qt5/lib/;/home/mollekopf/osxcross/osxcross/target/macports/pk gs/opt/local) set(CMAKE_OSX_SYSROOT /home/mollekopf/osxcross/osxcross/target/SDK/MacOSX10.11.sdk) # search for programs in the build host directories set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # for libraries and headers in the target directories set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) # Make sure Qt can be detected by CMake #set (QT_BINARY_DIR /opt/osxcross/bin /opt/osxcross/@TRIPLE@/lib/qt/bin) set (QT_INCLUDE_DIRS_NO_SYSTEM ON) set (CMAKE_AR:FILEPATH ${TOOLCHAIN_PREFIX}-ar) set (CMAKE_RANLIB:FILEPATH ${TOOLCHAIN_PREFIX}-ranlib)