/app/src/main.cpp (or /app/src/main.c) — a minimal program source (e.g., prints something or returns 0).
Behavior expected by the verifier
The verifier will create a build directory and run the CMake configuration command pointing at the repository root (the directory containing CMakeLists.txt). Your CMake configuration must succeed (exit code 0) when run from a build directory (i.e., cmake ../).
The CMakeLists.txt should be portable: set a reasonable minimum CMake version, declare a project name, and add an executable target that uses the provided source file(s).
The project should work with the default generator (Makefiles) and with Xcode generator (i.e., it must be valid CMake project that CMake can generate for multiple generators).
Inputs and outputs
Input: none taken from stdin. The verifier runs CMake against your project files.
Output: correct CMake configuration files generated inside the build directory (no errors). Optionally, building the project afterwards should produce a working executable.
Notes and constraints
Do not assume any special environment variables or user input during configuration.
Keep paths relative / generic so out-of-source configuration (build dir separate from source) works without modification.
Place all required files inside /app/ as specified above.
Tests
The following test script will be used to verify your solution:
bash
#!/bin/bash
set -e
cd "`dirname "$0"`"
if [ ! -d build ]; then
mkdir build
fi
cd build
rm CMakeCache.txt
if [[ "$OSTYPE" == "darwin"* ]]; then
cmake -G Xcode ../
else
cmake ../
fi
if [ ! $? -eq 0 ]; then
echo "error - cmake"
fi
cd ..