0

I have incompatible sh.exe and make.exe in my path due to multiple toolchains for embedded development. I want to force use of the one not in my path.

cmake used the wrong make (the one in the path) to check GCC functionnality and I could force the correct make with SET(CMAKE_MAKE_PROGRAM .../make.exe)

How to do the same for sh.exe ?

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Julien
  • 1,810
  • 1
  • 16
  • 34
  • 1
    Do we talk about `add_custom_command()` or `execute_process()`? Generally speaking CMake does not use `sh.exe` directly (see e.g. [here](https://stackoverflow.com/questions/39984876/how-are-cmake-execute-process-commands-run)). Or can you state where you have a problem with `sh.exe`? Error messages? – Florian Mar 27 '17 at 16:02
  • @Florian In fact I use `arm-none-eabi-gcc` and `cmake` tries to check the compiler by compiling a sample program. If atmelStudio's `sh` is in the path the build fails with : `/usr/bin/sh: -c: line 3: syntax error: unexpected end of file` if it is not in the path, compile is successful – Julien Mar 28 '17 at 06:06
  • Forcing the `make` program is always tricky. Can you please add your `cmake` command line call also? Otherwise I think you could utilize/modify my `CMAKE_IGNORE_PATH` approach described [here](https://stackoverflow.com/questions/43069632/environment-variable-used-by-cmake-to-detect-visual-c-compiler-tools-for-ninja/43102844#43102844) – Florian Mar 29 '17 at 20:30
  • @Florian Thank you for this reply, `CMAKE_IGNORE_PATH` is definitely a good proposition. About `CMAKE_MAKE_PROGRAM` I already removed it as it caused some problems. FYI: I run on windows and build with `sh` doesn't work as well as default `cmd`. I had make errors with no error description with the first one – Julien Mar 30 '17 at 06:10

1 Answers1

1

Turning my comment into an answer

To make CMake to ignore the toolchain in your path you can utilize CMAKE_IGNORE_PATH with something like:

cmake -DCMAKE_IGNORE_PATH="/path/to/your/toolchain/bin" ..

Just be aware that the path has to be exact string match for the path (in CMake format with / slashes and it's case sensitive).

For more details: Environment variable used by CMake to detect Visual C++ compiler tools for Ninja

Florian
  • 39,996
  • 9
  • 133
  • 149