How do I configure bitbucket-pipelines.yml to use cmake or make on repo?

Viewed 1932

I have a C++ repo that I've started a pipeline on commit. It's currently on "default" until I get it working then I'll get more specific with it.

Below is the YML. Note that I've commented out the build and push of the Docker Hub image. I don't want to build a new image every time and the image specified at the top is already at the state I need to build my repo.

Here's the deal, I want to deploy my C++ code (it's a CMAKE project) onto that docker image and build (make) it. But I have this error:

+ make make: *** No targets specified and no makefile found. Stop.

I can't find/understand the documentation on this step of the process. How can I MAKE my code base against this Docker image?

bitbucket-pipelines.yml:

# You can specify a custom docker image from Docker Hub as your build environment.
image: scottieg40/linux:buildEnv

pipelines:
default:
# - step:
    # services:
      # - docker
    # script: # Modify the commands below to build your repository.
      # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
      # - export IMAGE_NAME=scottieg40/linux:$BITBUCKET_COMMIT

      # build the Docker image (this will use the Dockerfile in the root of the repo)
      # - docker build -t $IMAGE_NAME .
      # authenticate with the Docker Hub registry
      # - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
      # push the new Docker image to the Docker registry
      # - docker push $IMAGE_NAME
- step:
    script:
    - ls
    - cmake
    - make
1 Answers

I figured it out. After realizing that everything in the script section of the YML is bash, my -ls revealed that my code is there ready to be built.

Trial and error led me to this: Stackoverflow answer that helped

The answer was:

- step: 
  script: 
  - cmake . 
  - cmake --build . --target all

I hope this helps anyone.

Related