I have a PNaCl program that I'm trying to compile using CMake.
I included the following lines but doest not work at all:
# disable compiler detection
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" Clang)
CMAKE_FORCE_CXX_COMPILER("${CMAKE_CXX_COMPILER}" Clang)
# specify cross-compilers
set(NACL_BIN /usr/local/share/nacl_sdk/pepper_43/toolchain/mac_pnacl/bin)
set(CMAKE_C_COMPILER "${NACL_BIN}/pnacl-clang" CACHE PATH "gcc" FORCE)
set(CMAKE_CXX_COMPILER "${NACL_BIN}/pnacl-clang++" CACHE PATH "g++" FORCE)
set(CMAKE_AR "${NACL_BIN}/pnacl-ar" CACHE PATH "archive" FORCE)
set(CMAKE_LINKER "${NACL_BIN}/pnacl-clang++" CACHE PATH "linker" FORCE)
set(CMAKE_RANLIB "${NACL_BIN}/pnacl-ranlib" CACHE PATH "ranlib" FORCE)
Error printing:
pnacl-ld: Unrecognized option: -search_paths_first
Based on Derek's answer:
set(CMAKE_SYSTEM_NAME "Generic" CACHE STRING "Target system.")
Otherwise, CMAKE will use specific flag.