summaryrefslogtreecommitdiff
path: root/package/pkg-cmaketargets.mk
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-04-17 16:45:23 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2012-04-20 00:01:03 +0200
commit486253db302d4b277db1d2bff0e175e5950e0d1c (patch)
tree537e479f760b17633f98deef58f52c7f015ac2fd /package/pkg-cmaketargets.mk
parentb7285d0058978fb88a94985dba150e849e4d9a69 (diff)
cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
This also requires moving a few include directives below the "all:" target in the main Makefile, otherwise the new target to create the toolchain file in pkg-cmaketargets.mk gets used as the default make target instead of "all:". Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/pkg-cmaketargets.mk')
-rw-r--r--package/pkg-cmaketargets.mk22
1 files changed, 22 insertions, 0 deletions
diff --git a/package/pkg-cmaketargets.mk b/package/pkg-cmaketargets.mk
index 1cd65e46f..371ab11c7 100644
--- a/package/pkg-cmaketargets.mk
+++ b/package/pkg-cmaketargets.mk
@@ -197,3 +197,25 @@ else
$(call CMAKETARGETS_INNER,$(call pkgname),$(call UPPERCASE,$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),target)
endif
endef
+
+################################################################################
+# Generation of the CMake toolchain file
+################################################################################
+
+$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
+ @mkdir -p $(@D)
+ @echo -en "\
+ set(CMAKE_SYSTEM_NAME Linux)\n\
+ set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
+ set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
+ set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
+ set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(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\
+ " > $@
+