Scenario
I have a CMake project on AppVeyor that I am trying to add Linux Builds to. My Windows builds use a CMake generator in the before_build
script to generate a visual studio solution which is built with build: project
.
I want to perform my Linux builds with build_script:
instead. However, when I add a build script to the matrix I get the error:
The build phase is set to "MSBuild" mode (default), but no Visual Studio project or solution files were found in the root directory. If you are not building Visual Studio project switch build mode to "Script" and provide your custom build command.
Attempted solutions
I have tried adding build: off
and build: Script
to the matrix however none of those options helped. Is my only option to define a script for Windows and use build_script
on both platforms?
Example
My appveyor.yml
file looks like this
version: 'build-{build}-{branch}'
image:
- Visual Studio 2017
- Ubuntu
platform:
- x64
configuration:
- Release
- Debug
environment:
APPVEYOR_YML_DISABLE_PS_LINUX: true
install:
- ps: .\install-dependency.ps1
- sh: ./install-dependency.sh
for:
-
matrix:
only:
- image: Ubuntu
before_build:
- mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% ..
build_script:
- make
-
matrix:
only:
- image: Visual Studio 2017
before_build:
- cmake -G "Visual Studio 15 2017" -A x64 .
build:
project: $(APPVEYOR_PROJECT_NAME).sln
test_script:
- CTest -C %CONFIGURATION%
Attempted solution details
For reference this is how I tried specifying the build options
matrix:
only:
- image: Ubuntu
build: Script
before_build:
- mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% ..
Further Research
I tried performing a standalone Linux build, everything works as expected and I don't need to modify any script
parameters. Maybe AppVeyor does not support mixing build types even with a matrix set up.
version: 'build-{build}-{branch}'
image: Ubuntu
platform:
- x64
configuration:
- Release
- Debug
install:
- sh: ./install-dependency.sh
before_build:
- mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% ..
build_script:
- make
test_script:
- ctest -C %CONFIGURATION%