felixjones / gba-toolchain

CMake based toolchain for GBA homebrew development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

${CMAKE_HOST_SYSTEM_PROCESSOR} Returns Nothing If Invoked On Ubuntu 22.04 Prior to defining project, causing the toolchain file to fail.

tfinnegan937 opened this issue · comments

I ran into this problem when trying to invoke the toolchain on the provided samples.

Here are the commands that I invoked:

cd /opt/gba-toolchain/samples/My\01\ My\ first\ GBA\ demo
`cmake --toolchain /opt/gba-toolchain/arm-gba-toolchain.cmake ./

And this produced the following error:
`tim@tim-virtual-machine:/opt/gba-toolchain/samples/01 My first GBA demo$ cmake --toolchain /opt/gba-toolchain/arm-gba-toolchain.cmake ./
CMake Error at /opt/gba-toolchain/arm-gba-toolchain.cmake:63 (message):
message called with incorrect number of arguments
Call Stack (most recent call first):
CMakeLists.txt:12 (include)

CMake Error at /opt/gba-toolchain/arm-gba-toolchain.cmake:87 (message):
Unsupported platform "Linux"
Call Stack (most recent call first):
CMakeLists.txt:12 (include)
`

This occurs because ${CMAKE_HOST_SYSTEM_PROCESSOR} does not return a value on some systems unless invoked AFTER defining a project with the project() command.

If I add the following to the cmake file:
include(/opt/gba-toolchain/arm-gba-toolchain.cmake)

AFTER project() is invoked for the sample, cmake processing completes successfully and I can build.

The following stack overflow response shows the issue:
https://stackoverflow.com/questions/51024294/cmake-system-processor-seems-to-be-empty-whats-the-best-strategy-for-os-agnost

Strangely, this issue went away completely when deleting and re-downloading the repo, so I chock it up to user error.