CMAKE_{AR,STRIP,LINKER,RANLIB,OBJCOPY} are set incorrectly when overridden
I've tried this with CMake 3.5 and 3.11, on GNU/Linux systems.
If I have a simple CMakeLists.txt file:
$ cd /tmp/obj
$ cat ../src/CMakeLists.txt
PROJECT(foobar)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
Then I run cmake
while overriding any of the variables in the subject:
$ type -a mklib
/tools/bin/mklib
$ mklib
mklib version 1.0
$ cmake CMAKE_AR=mklib ../src
Then cmake does completely the wrong thing and assumes that this tool exists in the local directory rather than on the PATH where it really exists:
$ grep mklib CMakeCache.txt
CMAKE_AR:FILEPATH=/tmp/obj/mklib
//ADVANCED property for variable: CMAKE_AR
CMAKE_AR-ADVANCED:INTERNAL=1
This obviously causes my builds to fail since that binary doesn't exist at that path.
The same behavior happens for the CMAKE_LINKER
, CMAKE_RANLIB
, CMAKE_STRIP
, and CMAKE_OBJCOPY
variable assignments.
Oddly, the CMAKE_C_COMPILER
and CMAKE_CXX_COMPILER
variables do work properly (that is, if I override them with a simple command name that command is looked up in the PATH
and the correct value is substituted rather than assuming the local directory).