Cmake plugin error

Hi there.
Last winter (or summer, depending on where you are in the world) I was frustrated with the lack of customization that GNOME-Nibbles had, so I made my own clone. And thinking that others might like it, I’ve been trying to use snapcraft to package it.
But when running `$ snapcraft build’ I get this output:

caleb@whistling-duck:~/projects/gladupe$ snapcraft build
Skipping pull gladupe (already ran)                                             
Building gladupe 
cmake /root/parts/gladupe/src -DCMAKE_INSTALL_PREFIX= -B build/
CMake Error: The current CMakeCache.txt directory /root/parts/gladupe/src/CMakeCache.txt is different than the directory /home/caleb/projects/gladupe where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
Failed to run 'cmake /root/parts/gladupe/src -DCMAKE_INSTALL_PREFIX= -B build/' for 'gladupe': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
caleb@whistling-duck:~/projects/gladupe$

My projects setup is:

caleb@whistling-duck:~/projects/gladupe$ ls
build  CMakeLists.txt  data  gui  gui_assets.bin  gui.bin  quill.toml  README  run.sh  snap  src  tags
caleb@whistling-duck:~/projects/gladupe$ ls build
CMakeCache.txt  CMakeFiles  cmake_install.cmake  gladupe  Makefile
caleb@whistling-duck:~/projects/gladupe$ ls src
cfgpath.h     event_layer.c  food.c  game.c  idents.h  lobby.h  map.c         map_editor.h  map_loader.c map_saver.c  prefs.c  reader.c  render.c  settings.c  worm.c  writer.c
cute_files.h  event_layer.h  food.h  game.h  lobby.c   main.c   map_editor.c  map.h         map_loader.h  map_saver.h  prefs.h  reader.h  render.h  settings.h  worm.h  writer.h
caleb@whistling-duck:~/projects/gladupe$

A snippet of my snap/snapcraft.yaml is:

parts:
    gladupe:
        plugin: cmake
        source: .
        configflags:
            - -B build/
        build-packages:
            - make
            - g++
            - libsdl2-dev
            #- libc
            - ink
        stage-packages:
            - libsdl2-dev
            #- libc

So, how do I edit my CMakeCache.txt file to get the desired result?

And also, how do I set libc as a dependency? If I uncomment those lines it gives me an error.
The other one is what does the -DCMAKE_INSTALL_PREFIX flag in cmake?

Thanks.

You don’t need libc as a dependency. It’s there by default.

What is the environment you’re building in?
What is the output of snap version?
What is the output of snapcraft --version

Here’s what I get:

caleb@whistling-duck:~/projects/gladupe$ snap version
snap    2.42.5
snapd   2.42.5
series  16
ubuntu  19.10
kernel  5.3.0-24-generic
caleb@whistling-duck:~/projects/gladupe$ snapcraft --version
snapcraft, version 3.8
caleb@whistling-duck:~/projects/gladupe$ 

I’m using make.
I set up the build directory with

caleb@whistling-duck:~/projects/gladupe$ (cd build; cmake ..)

And I run it with

caleb@whistling-duck:~/projects/gladupe$ make -C build && ./build/gladupe