Build for different platforms with the same source

I need to build my app for different platforms(for exmple: Linux and Android) with the same source. cmake is applied. Is it possible to add two sets of build steps to do it in one Jenkins’ configure?
The typical steps are

  1. CMake build
  2. CPack
  3. execute shell
    I want to do it twice with different settings(same source).

Sounds like you more or less want to use a matrix - Welcome to the Matrix - Though you could also parallel - Parallel stages with Declarative Pipeline 1.2 steps
or just execute another shell.

Sounds like you are using freestyle job. Its a lot less flexible than pipeline. In pipeline you could just call cmake multiple times serially or in parallel, but freestyle you are kinda ironically kinda limited. That being said, you can just add multiple cmake steps can’t you?

Thanks for your reply. You are right that freestyle is applied in my build. I will try pipeline. I appreciate your help.

(I’m writing this from memory so might be slightly wrong)

something like

pipeline {
   stages {
     stage('build android') {
       steps {
         sh('cmake --android')
       }
     }
     stage('build android') {
       steps {
         sh('cmake --linux')
       }
     }
   }
}

If you want to take advantage of the cmake auto installer stuff, you’ll want to look at Pipeline Syntax

The sidebar of your pipeline job will also have a syntax generator which will be a lot of help

Will try it out. Thank you so much!