Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PICOTOOL_OVERRIDE_DIR #1820

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tools/Findpicotool.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@
#
cmake_minimum_required(VERSION 3.17)

# if PICOTOOL_OVERRIDE_DIR system environment variable is set,
# then use that as the folder for the picotool executable
if (DEFINED ENV{PICOTOOL_OVERRIDE_DIR})
message("PICOTOOL_OVERRIDE_DIR env var is set to '$ENV{PICOTOOL_OVERRIDE_DIR}'")
add_executable(picotool IMPORTED GLOBAL)
set_property(TARGET picotool PROPERTY IMPORTED_LOCATION $ENV{PICOTOOL_OVERRIDE_DIR}/picotool)
# check the picotool version:
execute_process(COMMAND $ENV{PICOTOOL_OVERRIDE_DIR}/picotool version
OUTPUT_VARIABLE PICOTOOL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "^picotool v${picotool_VERSION_REQUIRED}" PICOTOOL_VERSION_MATCH ${PICOTOOL_VERSION})
if (NOT PICOTOOL_VERSION_MATCH)
message("picotool version response was: ${PICOTOOL_VERSION}")
message(FATAL_ERROR "PICOTOOL_OVERRIDE_DIR is set to '$ENV{PICOTOOL_OVERRIDE_DIR}', but the version of picotool found is not ${picotool_VERSION_REQUIRED}")
endif()
endif ()

if (NOT TARGET picotool)
include(ExternalProject)

Expand Down