summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2011-01-26 22:18:42 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2011-01-26 23:22:32 +0100
commit73144a6e02a67f9e7da276cd35c9d146e187653a (patch)
tree1b38a45bfc7d7b016524d774bc8c4209112717ce /Makefile
parent0fa46e59db087478b4844b2358a496eacdef7569 (diff)
downloadbuildroot-novena-73144a6e02a67f9e7da276cd35c9d146e187653a.tar.gz
buildroot-novena-73144a6e02a67f9e7da276cd35c9d146e187653a.zip
Makefile: generate CMake toolchain-file in $(O)
A CMake toolchain-file makes it easy to develop CMake-based packages outside of Buildroot. Just give the toolchain-file to CMake via the -DCMAKE_TOOLCHAIN_FILE=... option. Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a5a37a1ee..04783f2ef 100644
--- a/Makefile
+++ b/Makefile
@@ -363,7 +363,7 @@ $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
-$(BASE_TARGETS): dirs
+$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake
$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
$(MAKE) $(EXTRAMAKEARGS) silentoldconfig
@@ -372,6 +372,21 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
world: prepare dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL)
+$(O)/toolchainfile.cmake:
+ @echo -en "\
+ set(CMAKE_SYSTEM_NAME Linux)\n\
+ set(CMAKE_C_COMPILER $(CMAKE_TARGET_CC))\n\
+ set(CMAKE_CXX_COMPILER $(CMAKE_TARGET_CXX))\n\
+ set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(CMAKE_TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
+ set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(CMAKE_TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
+ set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
+ set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
+ set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
+ set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
+ " > $@
.PHONY: all world dirs clean distclean source outputmakefile \
$(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \