From 8dc2793f5fc4b98abe6057ed686bd70d1b1ebbb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 26 Jun 2018 16:36:27 +0200 Subject: [PATCH] Cable 0.2.3: Allow loading toolchain files from outside of cable dir --- cmake/cable/CableToolchains.cmake | 9 ++++++++- cmake/cable/bootstrap.cmake | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/cable/CableToolchains.cmake b/cmake/cable/CableToolchains.cmake index b881b35..d5af2cb 100644 --- a/cmake/cable/CableToolchains.cmake +++ b/cmake/cable/CableToolchains.cmake @@ -17,8 +17,15 @@ function(cable_configure_toolchain) set(TOOLCHAIN ${default_toolchain} CACHE STRING "CMake toolchain") - set(toolchain_file ${cable_toolchain_dir}/${TOOLCHAIN}.cmake) + 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() + cable_debug("Toolchain file: ${toolchain_file}") set(CMAKE_TOOLCHAIN_FILE ${toolchain_file} CACHE FILEPATH "CMake toolchain file") endif() endfunction() diff --git a/cmake/cable/bootstrap.cmake b/cmake/cable/bootstrap.cmake index 4255ae6..479c9fe 100644 --- a/cmake/cable/bootstrap.cmake +++ b/cmake/cable/bootstrap.cmake @@ -10,7 +10,7 @@ # # This is internal variable automaticaly updated with external tools. # Use CABLE_VERSION variable if you need this information. -set(version 0.2.2) +set(version 0.2.3) # For conveniance, add the project CMake module dir to module path. set(module_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -18,7 +18,6 @@ if(EXISTS ${module_dir}) list(APPEND CMAKE_MODULE_PATH ${module_dir}) endif() - if(CABLE_VERSION) # Some other instance of Cable was initialized in the top project. @@ -45,7 +44,7 @@ if(CABLE_VERSION) message( ${severity} - "[cable ] Parent Cable ${CABLE_VERSION} (${comment}) initialized in `${cable_top_project_name}` project" + "[cable ] Cable ${CABLE_VERSION} (${comment}) initialized in the `${cable_top_project_name}` parent project" ) cable_debug("Project CMake modules directory: ${module_dir}")