Using MSVC with cmake on Travis CI Windows

Viewed 240

I have a C++ project that uses cmake as it's build system and I'm trying to setup CI on Windows with Travis CI.

I'm installing the MSVC BuildTools using the following inside a powershell script

choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

I'm struggling to get cmake to recognize and use cl.exe as the compiler though. I can pass the absolute path with -DCMAKE_CXX_COMPILER which results in the following error:

CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):
  The C++ compiler
    "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe"
  is not able to compile a simple test program.
  It fails with the following output:
    Change Dir: C:/Users/travis/build/Project/CMakeFiles/CMakeTmp
0 Answers
Related