Initial cmake run polutes the environment
Using this CMakeLists.txt
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(test)
message(ERROR "CC is $ENV{CC}")
message(FATAL_ERROR "CXX is $ENV{CXX}")
I get, with cmake 3.18.3,
$ cmake .
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
ERRORCC is /usr/bin/cc
CMake Error at CMakeLists.txt:6 (message):
CXX is /usr/bin/c++
-- Configuring incomplete, errors occurred!
See also ".../CMakeFiles/CMakeOutput.log".
$ cmake .
ERRORCC is
CMake Error at CMakeLists.txt:6 (message):
CXX is
-- Configuring incomplete, errors occurred!
See also ".../CMakeFiles/CMakeOutput.log".
$
In my build this is making a config.guess (https://git.savannah.gnu.org/cgit/config.git/tree/config.guess) run under cmake's execute_process()
return wrong information.