Code: Select all
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)
# which compilers to use for C and C++
set(CMAKE_C_COMPILER aarch64-rpi4-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-rpi4-linux-gnu-g++)
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH /workdir/crosstool-ng/x-tools/aarch64-rpi4-linux-gnu)
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Code: Select all
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../cross.cmake ..
Code: Select all
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Looking for use_default_colors
-- Looking for use_default_colors - not found
What is the correct workflow here? Basically, I have an application that uses external library (ncurses) and I want to cross compile it for another architecture.
Refs:
https://github.com/abishekvashok/cmatrix
https://cmake.org/cmake/help/book/maste ... CMake.html