I have a proven toolchain and CMakeLists.txt for the ARM Compiler 6 armclang toolchain. I am running on Windows. It works fine when I run cmake from the ARM Dev Studio Command Prompt (which sets appropriate environment variables) but when I run from a normal command prompt, in which I have attempted to set a similar environment, the compiler test fails:
>cmake -DCMAKE_MAKE_PROGRAM=make.exe -DCMAKE_TOOLCHAIN_FILE="armclang_toolchain.cmake" -G "Unix Makefiles" ..
-- The C compiler identification is ARMClang 6.16.1
-- The CXX compiler identification is ARMClang 6.16.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe
-- Check for working C compiler: C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/SVNProj/<snip>/build/CMakeFiles/CMakeTmp
Run Build Command(s):make.exe -f Makefile cmTC_4826e/fast && make.exe -f CMakeFiles/cmTC_4826e.dir/build.make CMakeFiles/cmTC_4826e.dir/build
make.exe[1]: Entering directory `C:/<snip>/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4826e.dir/testCCompiler.o
"C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe" --target=arm-arm-none-eabi -MD -MT CMakeFiles/cmTC_4826e.dir/testCCompiler.o -MF CMakeFiles/cmTC_4826e.dir/testCCompiler.o.d -o CMakeFiles/cmTC_4826e.dir/testCCompiler.o -c C:/<snip>/build/CMakeFiles/CMakeTmp/testCCompiler.c
warning: 'armv4t' is unsupported in this version of the product
warning: 'arm7tdmi' is unsupported in this version of the product
Linking C static library libcmTC_4826e.a
"C:/Program Files/CMake/bin/cmake.exe" -P CMakeFiles/cmTC_4826e.dir/cmake_clean_target.cmake
C:/Strawberry/c/bin/ar.exe --create -cr libcmTC_4826e.a "CMakeFiles/cmTC_4826e.dir/testCCompiler.o"
C:/Strawberry/c/bin/ar.exe: unknown option -- create
Usage: C:/Strawberry/c/bin/ar.exe [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
C:/Strawberry/c/bin/ar.exe -M [<mri-script]
commands:
d - delete file(s) from the archive
m[ab] - move file(s) in the archive
p - print file(s) found in the archive
q[f] - quick append file(s) to the archive
<snip>
Obviously something is wrong with my environment but I can’t identify what exactly. Any idea why C:/Strawberry/c/bin/ar.exe (which is installed on my machine) is getting invoked?