cmakebiicode

Passing cmake command-line options from bii


How do I pass command-line options to cmake from bii? I tried passing -Wdev and --debug-output like this:

bii build -Wdev --debug-output

but it doesn't work:

INFO: Processing changes...
Building: "cmake" --build . -Wdev --debug-output
Unknown argument -Wdev
Unknown argument --debug-output
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
  <dir>          = Project binary directory to be built.
  --target <tgt> = Build <tgt> instead of default targets.
  --config <cfg> = For multi-configuration tools, choose <cfg>.
  --clean-first  = Build target 'clean' first, then build.
                   (To clean only, use --target 'clean'.)
  --use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
  --             = Pass remaining options to the native tool.
ERROR: Build failed

Solution

  • The bii build command is not invoking cmake project configuration, it is calling the cmake --build (you can see it in the output), which in turn runs the underlaying build system, make, MSBuild...

    Those options can be pased to the bii configure command, prior to invoking bii build. Try:

    $  bii configure -Wdev --debug-output
    

    You might see in the console output something as:

    Running: "C:/.../.biicode/cmake-3.2.2-win32-x86/bin\cmake"  -G "MinGW Makefiles" -Wno-dev -Wdev --debug-output ..\cmake
    Running with debug output on.
    
                    BLOCK: diego/prueba
       Called from: [1]     C:/.../prueba/bii/cmake/CMakeLists.txt
    -----------------------------------------------------------
       Called from: [1]     C:/.../prueba/bii/cmake/CMakeLists.txt
    

    Which indicates that it is working. By default bii adds the -Wno-dev to the configuration options, but as the user options (in this case -Wdev) comes later, cmake keeps the latest, so it works too.