* Fix crossbuild on CentOS
This change fixes the crossbuilding to work on CentOS. Clang
frontend presets some of the compiler options based on the
host OS and I guess that's causing the need to add the
`--rpath-link`.
The ranlib change to use llvm ranlib fixed a problem where
cmake attempted to use ranlib from the rootfs for some
reason.
* Reflect PR feedback
set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE)
endfunction()
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib/${TOOLCHAIN}")
+ add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}")
+endif()
if(TARGET_ARCH_NAME STREQUAL "armel")
if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only
locate_toolchain_exec(ar CMAKE_AR)
locate_toolchain_exec(nm CMAKE_NM)
+ locate_toolchain_exec(ranlib CMAKE_RANLIB)
- if(CMAKE_C_COMPILER_ID MATCHES "GNU")
- locate_toolchain_exec(ranlib CMAKE_RANLIB)
- else()
+ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
locate_toolchain_exec(link CMAKE_LINKER)
endif()