[CMake] conflict between configure & build steps in gitlab-runner script for Windows: Debug or Release build directory not found

Joachim Wuttke j.wuttke at fz-juelich.de
Fri Mar 22 09:53:26 EDT 2019


A gitlab-runner configuration script .gitlab-ci.yml, for execution in the Powershell:

===
windows:
   tags:
   - windows
   stage: build
   script:
     - New-Item -ItemType "directory" -Confirm:$false -Force:$true -Name "build"
     - cd build
     - cmd.exe "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
     - cmake -G "Visual Studio 15 2017" -A x64 -T host=x64 -DCERF_CPP=ON -DLIB_MAN=OFF -DLIB_INSTALL=OFF -B. ..
     - cmake -j8 --build . --config Debug
     - ctest -j4
===

results in

===
$ cd build
$ cmd.exe "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
Microsoft Windows [Version 10.0.17134.648]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\gitlab-runner\builds\s-nngMTK\0\mlz\libcerf\build>$ cmake -G "Visual Studio 15 2017" -A x64 -T host=x64 -DCERF_CPP=ON -DLIB_MAN=OFF -DLIB_INSTALL=OFF -B. ..
-- The CXX compiler identification is MSVC 19.16.27026.1
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build C++ library libcerfcpp
-- libcerf/lib: build library cerfcpp, CERF_CPP=ON, shared=ON
-- Configuring done
-- Generating done
-- Build files have been written to: C:/gitlab-runner/builds/xxxxxxxx/libcerf/build
$ cmake -j8 --build . --config Debug
CMake Error: The source directory "C:/gitlab-runner/builds/xxxxxxxx/libcerf/build/Debug" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

ERROR: Job failed: exit status 1
===

How to resolve this conflict between the configure step (cmake) and
the build step (cmake --build)?

The latter won't work without the option "--config Debug";
but if that option is given, then it looks for a nonexistent directory.

The same problem occurs with "--config Release".

/Joachim


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://cmake.org/pipermail/cmake/attachments/20190322/4566b18c/attachment-0001.bin>


More information about the CMake mailing list