How to "cmake .." during build?

Hello all. I’ve recently begun creating a Flatpak for an older piece of software that requires several outdated dependencies. The particular version of OpenImageIO required cannot be built in the root directory of the source, throwing the following error:

if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
    message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()

If this were being compiled in a terminal, the straightforward fix would be to execute the following commands in the source directory:

mkdir build && cd build && cmake ..

However, I am unsure of how to do this in my Flatpak manifest. I have tried both the build-dir and subdir options mentioned in the Flatpak command reference but have not had luck with either. My current command for this module is shown below.

  - name: OpenImageIO
    buildsystem: cmake
    build-options:
      cxxflags: -std=c++11 -Wno-error=stringop-truncation -Wno-error=class-memaccess -Wno-error=sizeof-pointer-memaccess -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow= -Wno-error=misleading-indentation -Wno-error=format-truncation= -Wno-error=aligned-new= -Wno-error=mismatched-new-delete
    config-opts:
      - -D BUILD_TESTING=OFF
      - -D INSTALL_DOCS=OFF
      - -D INSTALL_FONTS=OFF
      - -D OIIO_BUILD_TESTS=OFF
      - -D OIIO_BUILD_TOOLS=OFF
      - -D STOP_ON_WARNING=OFF
      - -D USE_FFMPEG=OFF
      - -D USE_FIELD3D=OFF
      - -D USE_FREETYPE=OFF
      - -D USE_LIBRAW=OFF
      - -D USE_NUKE=OFF
      - -D USE_OCIO=OFF
      - -D USE_QT=OFF
    sources:
      - type: git
        url: https://github.com/OpenImageIO/oiio.git
        tag: Release-1.3.14

Any help is appreciated!

Nevermind i cant read

Nevermind again.

I actually tried building the thing, and adding builddir: true does indeed seem to pass the check.

Are you sure you didnt make a typo?

Just for reference the module would look like this:

  - name: OpenImageIO
    buildsystem: cmake
    builddir: true
    build-options:
      cxxflags: -std=c++11 -Wno-error=stringop-truncation -Wno-error=class-memaccess -Wno-error=sizeof-pointer-memaccess -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow= -Wno-error=misleading-indentation -Wno-error=format-truncation= -Wno-error=aligned-new= -Wno-error=mismatched-new-delete
    config-opts:
      - -D BUILD_TESTING=OFF
      - -D INSTALL_DOCS=OFF
      - -D INSTALL_FONTS=OFF
      - -D OIIO_BUILD_TESTS=OFF
      - -D OIIO_BUILD_TOOLS=OFF
      - -D STOP_ON_WARNING=OFF
      - -D USE_FFMPEG=OFF
      - -D USE_FIELD3D=OFF
      - -D USE_FREETYPE=OFF
      - -D USE_LIBRAW=OFF
      - -D USE_NUKE=OFF
      - -D USE_OCIO=OFF
      - -D USE_QT=OFF
    sources:
      - type: git
        url: https://github.com/OpenImageIO/oiio.git
        tag: Release-1.3.14

Thanks, I went back and deleted my .build-dir and .flatpak-builder directories (out of desperation :laughing:) and that fixed it; indeed the builddir: true option does work correctly here.

This solution was a bit surprising though, since I’ve been invoking the builder with flatpak-builder --install --install-deps-from=flathub --user --force-clean . So perhaps something was configured wrong on my end.