Cmake - это объявление. Я пытаюсь выполнить кросс-компиляцию для raspberry pi 3+ на Mac, используя cmake для генерации make-файла.Мой CMakeLists.txt:
cmake_minimum_required (VERSION 3.11.0)
project(decatrack)
# setup cross toolchain for RPi 3
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(TOOLCHAIN_DIR /Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/armv8-rpi3-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/armv8-rpi3-linux-gnueabihf-g++)
set(CMAKE_SYSROOT ${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/sysroot)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
unset(CMAKE_OSX_DEPLOYMENT_TARGET
# c++ standerd
# force cc++03 standard
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -ggdb -O0 -ffunction-sections -fdata-sections -v -shared-libgcc")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Using C++11")
include_directories(
${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/sysroot/usr/include
${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/include/c++/6.3.0
${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/include/c++/6.3.0/backward
${TOOLCHAIN_DIR}/lib/gcc/armv8-rpi3-linux-gnueabihf/6.3.0/include
${TOOLCHAIN_DIR}/lib/gcc/armv8-rpi3-linux-gnueabihf/6.3.0/include-fixed
${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/include
)
target_link_libraries (
${TOOLCHAIN_DIR}/armv8-rpi3-linux-gnueabihf/sysroot/lib/libpigpio.so
)
add_subdirectory(src)
Полученный файл flags.make выглядит следующим образом (вы должны прокрутить страницу, чтобы увидеть проблему:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.11
# compile CXX with /Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/bin/armv8-rpi3-linux-gnueabihf-g++
CXX_FLAGS = -std=c++11 -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -ggdb -O0 -ffunction-sections -fdata-sections -v -shared-libgcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=gnu++11
CXX_DEFINES =
CXX_INCLUDES = -I/Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include/c++/6.3.0 -I/Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include/c++/6.3.0/backward -I/Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/lib/gcc/armv8-rpi3-linux-gnueabihf/6.3.0/include -I/Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/lib/gcc/armv8-rpi3-linux-gnueabihf/6.3.0/include-fixed -I/Volumes/xtool-build-env/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include
Добавлено "-isysroot / Applications /"Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk "и я не могу понять, как это остановить !!!