[vlc-devel] [PATCH] contrib: Set _CMAKE_TOOLCHAIN_PREFIX

Martin Storsjö martin at martin.st
Mon Apr 1 23:13:48 CEST 2013


This is required for detecting ar and ranlib properly, required
e.g. when cross compiling for android from OS X.

One can't set CMAKE_AR or CMAKE_RANLIB directly. Normally they
should be set properly automatically within cmake, but those
codepaths seem to be skipped when we set the C/CXX compilers
manually.

---
Would it make sense to do this for all cases, not only for
android? (The condition basically is "whenever $(HOST) is set
properly".)
---
 contrib/src/main.mak |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 3222f6d..3eef365 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -392,6 +392,9 @@ ifdef HAVE_DARWIN_OS
 	echo "set(CMAKE_CXX_FLAGS $(CFLAGS))" >> $@
 	echo "set(CMAKE_LD_FLAGS $(LDFLAGS))" >> $@
 endif
+ifdef HAVE_ANDROID
+	echo "set(_CMAKE_TOOLCHAIN_PREFIX $(HOST)-)" >> $@
+endif
 	echo "set(CMAKE_C_COMPILER $(CC))" >> $@
 	echo "set(CMAKE_CXX_COMPILER $(CXX))" >> $@
 	echo "set(CMAKE_FIND_ROOT_PATH $(PREFIX))" >> $@
-- 
1.7.9.4




More information about the vlc-devel mailing list