Cable 0.2.3: Allow loading toolchain files from outside of cable dir

This commit is contained in:
Paweł Bylica 2018-06-26 16:36:27 +02:00
parent 81ac4b62ab
commit 8dc2793f5f
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 10 additions and 4 deletions

View File

@ -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()

View File

@ -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}")