# CMAKE\_MAKE\_PROGRAM issue 3.28.6-1.1

**URL:** <https://discourse.cmake.org/t/cmake-make-program-issue-3-28-6-1-1/13239>\
**Category:** Code\
**Created:** [December 20, 2024, 12:25am UTC](https://discourse.cmake.org/t/cmake-make-program-issue-3-28-6-1-1/13239 "2024-12-20T00:25:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trampas\_Stern](https://discourse.cmake.org/user_avatar/discourse.cmake.org/trampas_stern/32/5212_2.png) [@Trampas\_Stern](https://discourse.cmake.org/u/Trampas_Stern)\
**Post date:** [December 20, 2024, 12:25am UTC](https://discourse.cmake.org/t/cmake-make-program-issue-3-28-6-1-1/13239/1 "2024-12-20T00:25:15Z")

</div>

In my CMakeLists.txt I set the CMAKE\_MAKE\_PROGRAM to the specific version of ninja I want to use (which is same version as in my path).

set(CMAKE\_MAKE\_PROGRAM “${CMAKE\_SOURCE\_DIR}/xpacks/@xpack-dev-tools/ninja-build/.content/bin/ninja.exe”)

I also have this set.  
set(CMAKE\_TRY\_COMPILE\_TARGET\_TYPE “STATIC\_LIBRARY”)

However when I do this the compiler test fails:

> Compiling the C compiler identification source file “CMakeCCompilerId.c” failed.  
> Compiler: D:/Projects/SECA/LoRa/cmake\_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/arm-none-eabi-gcc.exe  
> Build flags:  
> Id flags:
> 
> ```
> The output was:
> 1
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-exit.o): in function `exit':
> exit.c:(.text.exit+0x28): undefined reference to `_exit'
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-closer.o): in function `_close_r':
> closer.c:(.text._close_r+0x18): undefined reference to `_close'
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-lseekr.o): in function `_lseek_r':
> lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-readr.o): in function `_read_r':
> readr.c:(.text._read_r+0x24): undefined reference to `_read'
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-writer.o): in function `_write_r':
> writer.c:(.text._write_r+0x24): undefined reference to `_write'
> D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/Projects/SECA/LoRa/cmake_test/xpacks/@xpack-dev-tools/arm-none-eabi-gcc/.content/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib\\libc.a(libc_a-sbrkr.o): in function `_sbrk_r':
> sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
> collect2.exe: error: ld returned 1 exit status
> 
> ```

This is done with this command line:

> Executing command: D:/Projects/SECA/LoRa/cmake\_test/xpacks/@xpack-dev-tools/cmake/.content/bin/cmake.exe -DCMAKE\_BUILD\_TYPE=Debug -SD:/Projects/SECA/LoRa/cmake\_test -BD:/Projects/SECA/LoRa/cmake\_test/build/debug -G Ninja

Now if I pass in the CMAKE\_MAKE\_PROGRAM via command line like this:

> D:/Projects/SECA/LoRa/cmake\_test/xpacks/@xpack-dev-tools/cmake/.content/bin/cmake.exe -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_MAKE\_PROGRAM=D:/Projects/SECA/LoRa/cmake\_test/xpacks/@xpack-dev-tools/ninja-build/.content/bin/ninja.exe -SD:/Projects/SECA/LoRa/cmake\_test -BD:/Projects/SECA/LoRa/cmake\_test/build/debug -G Ninja

Then the compiler is detected correctly.

A few notes, I am setting up cmake such that for each project I can use a different version of build tools as needed. In this case the version is the same as my path version, but might not be in the future. I figured that cmake or ninja has a bug that is causing an issue.

---

<div class="post-metadata">

**Author:** ![ilg](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ilg/32/865_2.png) [@ilg](https://discourse.cmake.org/u/ilg)\
**Post date:** [December 28, 2024, 3:14pm UTC](https://discourse.cmake.org/t/cmake-make-program-issue-3-28-6-1-1/13239/2 "2024-12-28T15:14:22Z")

</div>

arm-none-eabi-gcc is not auto-discoverable by cmake.

When using cross-compilers, you have to pass CMAKE\_TOOLCHAIN\_FILE to cmake, with a file defining CMAKE\_C\_COMPILER, CMAKE\_CXX\_COMPILER and other.

I collected some configuration details in the xpm documentation:

- [CMake Integration | xpm - The xPack Project Manager](https://xpack.github.io/xpm/docs/guide/cmake-integration/)

---

<div class="post-metadata">

**Author:** ![Trampas\_Stern](https://discourse.cmake.org/user_avatar/discourse.cmake.org/trampas_stern/32/5212_2.png) [@Trampas\_Stern](https://discourse.cmake.org/u/Trampas_Stern)\
**Post date:** [December 28, 2024, 4:23pm UTC](https://discourse.cmake.org/t/cmake-make-program-issue-3-28-6-1-1/13239/3 "2024-12-28T16:23:10Z")

</div>

In the documentation it is unclear to me how cmake is using the ninja executable from xpack install.

Thanks  
Trampas
