Files
Frédéric Desbiens 09c190a71d Added a CMake target for the Linux sample program (#622)
The CMake build produced libthreadx.a and nothing else, so trying ThreadX on
Linux meant using the Makefile beside the port instead. Build the demo the
Makefile builds, for the linux port and its SMP counterpart.

The target is behind an option that defaults off, so an ordinary build is
unchanged and still produces just the library. -DTHREADX_SAMPLE=ON adds it:

    cmake -S . -B build -DTHREADX_ARCH=linux -DTHREADX_TOOLCHAIN=gnu \
          -DTHREADX_SAMPLE=ON
    cmake --build build --target sample_threadx

The include path uses TX_COMMON_DIR rather than naming common or common_smp,
since the top level already resolves which of the two applies.

Verified by building and running both variants. Non-SMP prints

    **** ThreadX Linux Demonstration **** (c) 1996-2020 Microsoft Corporation

and SMP prints the SMP banner, both with the demo's thread counters advancing. A
default configure with no THREADX_SAMPLE has no sample_threadx target and still
produces libthreadx.a, so nothing existing moves.

Derived from the two example_build files in #404 by Yanfeng Liu, which had the
same goal. That change also rewrote the top level's SMP selection, added
common_smp/CMakeLists.txt and added ports_smp/linux/gnu/CMakeLists.txt; all three
have since arrived on dev by other routes, so only the sample targets were still
missing. The include path needed adjusting because the original depended on
THREADX_SMP being a string suffix, which it no longer is.

Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
2026-08-15 17:28:33 -04:00
..
…