pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

CMAKE_PREFIX_PATH content lost in middle of the CMake configuration step

Open opilat opened this issue 1 year ago • 1 comments

Pico examples project (picow_blink) configured with -DCMAKE_PREFIX_PATH=path_to_arm_none_eabi_toolchain command line option fails to configure. Before the C compiler test step, it loses the content of the CMAKE_PREFIX_PATH.
-- Detecting C compiler ABI info CMake Error at C:/Projects/pico/pico-sdk/cmake/preload/toolchains/find_compiler.cmake:28 (message): Compiler 'arm-none-eabi-gcc' not found, you can specify search path with "PICO_TOOLCHAIN_PATH". configure_issue.txt

opilat avatar Dec 12 '23 13:12 opilat

Note this issue can be fixed by either passing the CMAKE_PREFIX_PATH as an environment variable, or setting before running project:

set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PREFIX_PATH)

The problem is that try try_compile creates a CMakeFiles.txt that includes the preload/toolchains/pico_arm_gcc.cmake. I'm not sure how this mechanism should work, but seems like bad practice to depend on a specific ways to pass the variable. If something, I suggest using the variable above to pass the previously found compiler paths directly, instead of trying to find it again - since there may be other factors causing a different compiler is found in the toplevel cmake, and a different one is found in the generated try-compile cmake.

Krakonos avatar Dec 12 '23 13:12 Krakonos

Looks like this was fixed in the 2.0.0 release, by adding this line https://github.com/raspberrypi/pico-sdk/blob/efe2103f9b28458a1615ff096054479743ade236/cmake/pico_pre_load_toolchain.cmake#L7

Can you try the 2.0.0 release and confirm if this has fixed your issue?

will-v-pi avatar Nov 12 '24 11:11 will-v-pi

closing as this should have been fixed; please re-open if still an issue

kilograham avatar Nov 19 '24 19:11 kilograham