Environment variables are not passed to cmake steps when running in pipeline withEnv

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      CMake plugin commands do not seem to pass environment to cmake command.

      withEnv(['CC=clang', 'CXX=clang++' {
        cmakeBuild(
          buildDir: 'build/debug',
          buildType: 'Debug',
          generator: 'Ninja',
          installation: 'InSearchPath',
        )
      }

       

      [debug] $ docker exec --workdir /var/lib/jenkins/workspace/job/build/debug 67363250bd775405c7cdf92b70a6d7a70dc136a48c93e350fea9cd12ba50d432 cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug /var/lib/jenkins/workspace/job
      -- The C compiler identification is GNU 7.2.0
      -- The CXX compiler identification is GNU 7.2.0
      -- Check for working C compiler: /usr/sbin/cc
      -- Check for working C compiler: /usr/sbin/cc – works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Check for working CXX compiler: /usr/sbin/c++
      -- Check for working CXX compiler: /usr/sbin/c++ – works
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done

       

      Also, if CMake is installed in /usr/local/bin (and it works in sh step) the CMake builder plugin apparently does not find cmake binary:

      [debug] $ cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug /Users/jenkins/workspace/job
      Cannot run program "cmake" (in directory "/Users/jenkins/workspace/job/build/debug"): error=2, No such file or directory

      In sh step which cmake prints /usr/local/bin/cmake and you can run cmake succesfully

            Assignee:
            Martin Weber
            Reporter:
            Janne Rönkkö
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: