class_docstr: CMakeDefinition captures the cmake invocation arguments.
  
  It allows creating build directories with the same definition, e.g.
  ```
  build_1 = cmake_def.build("/tmp/build-1")
  build_2 = cmake_def.build("/tmp/build-2")
  
  ...
  
  build1.all()
  build2.all()
docstr: Invoke cmake into a build directory.
  
  Parameters
  ----------
  build_dir : str
              Directory in which the CMake build will be instantiated.
  force : bool
          If the build folder exists, delete it before. Otherwise if it's
          present, an error will be returned.
docstr_tok: ["Invoke","cmake","into","a","build","directory",".","Parameters","--","--","--","--","--","build_dir",":","str","Directory","in","which","the","CMake","build","will","be","instantiated",".","force",":","bool","If","the","build","folder","exists",",","delete","it","before",".","Otherwise","if","it's","present",",","an","error","will","be","returned","."]
code: def build(self, build_dir, force=False, cmd_kwargs=None, **kwargs):
      """Invoke cmake into a build directory.
  
      Parameters
      ----------
      build_dir : str
                  Directory in which the CMake build will be instantiated.
      force : bool
              If the build folder exists, delete it before. Otherwise if it's
              present, an error will be returned.
      """
      if os.path.exists(build_dir):
          # Extra safety to ensure we're deleting a build folder.
          if not CMakeBuild.is_build_dir(build_dir):
              raise FileExistsError(
                  "{} is not a cmake build".format(build_dir)
              )
          if not force:
              raise FileExistsError(
                  "{} exists use force=True".format(build_dir)
              )
          rmtree(build_dir)
  
      os.mkdir(build_dir)
  
      cmd_kwargs = cmd_kwargs if cmd_kwargs else {}
      cmake(*self.arguments, cwd=build_dir, env=self.env, **cmd_kwargs)
      return CMakeBuild(
          build_dir, self.build_type, definition=self, **kwargs
      )
  
imports: import os
  import re
  from shutil import rmtree, which
  from .command import Command, default_bin
label_desc: Use image node_id 3 for calling the CMakeDefinition obj's underlying member method code with example usage: obj.build(build_dir, force, cmd_kwargs) and returns: CMakeBuild