Skip to content

Commit c7462ae

Browse files
committed
Fix finding of XC8 exe on Windows.
1 parent ffb29d9 commit c7462ae

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Modules/Platform/MicrochipMCU-C-XC8.cmake

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,29 @@ if(NOT MICROCHIP_XC8_PATH)
2323
message(FATAL_ERROR
2424
"No Microchip XC8 compiler was found. Please provide the path"
2525
" to an XC8 installation on the command line, for example:\n"
26-
"cmake -DMICROCHIP_XC8_PATH=/opt/microchip/xc8/v2.00 ."
26+
" cmake -DMICROCHIP_XC8_PATH=/opt/microchip/xc8/v2.00 .."
2727
)
2828
endif()
2929

3030

31-
set(CMAKE_FIND_ROOT_PATH ${MICROCHIP_XC8_PATH})
31+
set(CMAKE_FIND_ROOT_PATH "${MICROCHIP_XC8_PATH}")
3232

3333
# skip compiler search and just use XC8
34-
find_program(CMAKE_C_COMPILER "xc8")
34+
find_program(CMAKE_C_COMPILER "xc8"
35+
PATHS "${MICROCHIP_XC8_PATH}"
36+
PATH_SUFFIXES "bin"
37+
)
38+
39+
if(NOT CMAKE_C_COMPILER)
40+
message(FATAL_ERROR
41+
"The XC8 compiler executable was not found, but what looks"
42+
" like an XC8 installation was found at:\n"
43+
" ${MICROCHIP_XC8_PATH}\n"
44+
"Please provide the path to a working XC8 installation on the"
45+
" command line, for example:\n"
46+
" cmake -DMICROCHIP_XC8_PATH=/opt/microchip/xc8/v2.00 .."
47+
)
48+
endif()
3549

3650
# skip compiler ID since XC8 isn't supported by CMake's test file
3751
set(CMAKE_C_COMPILER_ID_RUN 1)

0 commit comments

Comments
 (0)