Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 71085723f8028b3e1c4029fc1abe1243ac49ffc6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Cody P Schafer <dev@codyps.com> |
| 3 | Date: Thu, 27 Apr 2017 11:35:05 -0400 |
| 4 | Subject: [PATCH 1/5] CMakeDetermineSystem: use oe environment vars to load |
| 5 | default toolchain file in sdk |
| 6 | Organization: O.S. Systems Software LTDA. |
| 7 | |
| 8 | Passing the toolchain by: |
| 9 | |
| 10 | - shell aliases does not work if cmake is called by a script |
| 11 | - unconditionally by a wrapper script causes cmake to believe it is |
| 12 | configuring things when it is not (for example, `cmake --build` breaks). |
| 13 | |
| 14 | The OE_CMAKE_TOOLCHAIN_FILE variable is only used as a default if no |
| 15 | toolchain is explicitly specified. |
| 16 | |
| 17 | Setting the CMAKE_TOOLCHAIN_FILE cmake variable is marked as cached |
| 18 | because '-D' options are cache entries themselves. |
| 19 | |
| 20 | Upstream-Status: Inappropriate [oe-core specific] |
| 21 | Signed-off-by: Cody P Schafer <dev@codyps.com> |
| 22 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> |
| 23 | --- |
| 24 | Modules/CMakeDetermineSystem.cmake | 7 +++++++ |
| 25 | 1 file changed, 7 insertions(+) |
| 26 | |
| 27 | diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake |
| 28 | index 600d5580e..32d7f1945 100644 |
| 29 | --- a/Modules/CMakeDetermineSystem.cmake |
| 30 | +++ b/Modules/CMakeDetermineSystem.cmake |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 31 | @@ -81,6 +81,13 @@ else() |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 32 | endif() |
| 33 | endif() |
| 34 | |
| 35 | +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) |
| 36 | + if(DEFINED ENV{OE_CMAKE_TOOLCHAIN_FILE}) |
| 37 | + set(CMAKE_TOOLCHAIN_FILE "$ENV{OE_CMAKE_TOOLCHAIN_FILE}" CACHE FILEPATH "toolchain file") |
| 38 | + message(STATUS "Toolchain file defaulted to '${CMAKE_TOOLCHAIN_FILE}'") |
| 39 | + endif() |
| 40 | +endif() |
| 41 | + |
| 42 | # if a toolchain file is used, the user wants to cross compile. |
| 43 | # in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_* |
| 44 | # variables around so they can be used in CMakeLists.txt. |
| 45 | -- |
| 46 | 2.18.0 |
| 47 | |