diff --git a/cmake/Q7SCrossCompileConfig.cmake b/cmake/Q7SCrossCompileConfig.cmake index bc95a909..a4336983 100644 --- a/cmake/Q7SCrossCompileConfig.cmake +++ b/cmake/Q7SCrossCompileConfig.cmake @@ -1,10 +1,12 @@ # CROSS_COMPILE also needs to be set accordingly or passed to the CMake command - if(NOT DEFINED ENV{Q7S_SYSROOT}) -# message(FATAL_ERROR -# "Define the Q7S_ROOTFS variable to " -# "point to the raspbian rootfs." -# ) + # Sysroot has not been cached yet and was not set in environment either + if(NOT DEFINED SYSROOT_PATH) + message(FATAL_ERROR + "Define the Q7S_ROOTFS variable to " + "point to the raspbian rootfs." + ) + endif() else() set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path") endif() @@ -36,8 +38,11 @@ set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy") set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size") # At the very least, cross compile gcc and g++ have to be set! -find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED) -find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED) +find_program (CMAKE_C_COMPILER ${CROSS_COMPILE_CC} REQUIRED) +find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED) +# Useful utilities, not strictly necessary +find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE}) +find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY}) set(CMAKE_CROSSCOMPILING TRUE) set(CMAKE_SYSROOT "${SYSROOT_PATH}")