2018-05-11 14:58:08 +00:00
|
|
|
# Cable: CMake Bootstrap Library.
|
2018-04-10 14:28:36 +00:00
|
|
|
# Copyright 2018 Pawel Bylica.
|
|
|
|
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
|
|
|
|
|
|
|
|
set(cable_toolchain_dir ${CMAKE_CURRENT_LIST_DIR}/toolchains)
|
|
|
|
|
|
|
|
function(cable_configure_toolchain)
|
|
|
|
if(NOT PROJECT_IS_NESTED)
|
|
|
|
# Do this configuration only in the top project.
|
|
|
|
|
|
|
|
cmake_parse_arguments("" "" "DEFAULT" "" ${ARGN})
|
|
|
|
|
|
|
|
set(default_toolchain default)
|
|
|
|
if(_DEFAULT)
|
|
|
|
set(default_toolchain ${_DEFAULT})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOLCHAIN ${default_toolchain} CACHE STRING "CMake toolchain")
|
|
|
|
|
2018-06-26 14:36:27 +00:00
|
|
|
set(toolchain_file toolchains/${TOOLCHAIN}.cmake)
|
|
|
|
foreach(path ${CMAKE_MODULE_PATH})
|
|
|
|
if(EXISTS "${path}/${toolchain_file}")
|
|
|
|
set(toolchain_file "${path}/${toolchain_file}")
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2018-04-10 14:28:36 +00:00
|
|
|
|
2018-06-26 14:36:27 +00:00
|
|
|
cable_debug("Toolchain file: ${toolchain_file}")
|
2018-04-10 14:28:36 +00:00
|
|
|
set(CMAKE_TOOLCHAIN_FILE ${toolchain_file} CACHE FILEPATH "CMake toolchain file")
|
|
|
|
endif()
|
|
|
|
endfunction()
|