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: Initialize a CMakeDefinition
  
  Parameters
  ----------
  source : str
           Source directory where the top-level CMakeLists.txt is
           located. This is usually the root of the project.
  generator : str, optional
  definitions: list(str), optional
  env : dict(str,str), optional
        Environment to use when invoking cmake. This can be required to
        work around cmake deficiencies, e.g. CC and CXX.
docstr_tok: ["Initialize","a","CMakeDefinition","Parameters","--","--","--","--","--","source",":","str","Source","directory","where","the","top-level","CMakeLists.txt","is","located",".","This","is","usually","the","root","of","the","project",".","generator",":","str",",","optional","definitions",":","list","(","str",")",",","optional","env",":","dict","(","str",",","str",")",",","optional","Environment","to","use","when","invoking","cmake",".","This","can","be","required","to","work","around","cmake","deficiencies",",","e.g",".","CC","and","CXX","."]
code: def __init__(
      self,
      source,
      build_type="release",
      generator=None,
      definitions=None,
      env=None,
  ):
      """Initialize a CMakeDefinition
  
      Parameters
      ----------
      source : str
               Source directory where the top-level CMakeLists.txt is
               located. This is usually the root of the project.
      generator : str, optional
      definitions: list(str), optional
      env : dict(str,str), optional
            Environment to use when invoking cmake. This can be required to
            work around cmake deficiencies, e.g. CC and CXX.
      """
      self.source = os.path.abspath(source)
      self.build_type = build_type
      self.generator = (
          generator if generator else cmake.default_generator()
      )
      self.definitions = definitions if definitions else []
      self.env = env
  
imports: import os
  import re
  from shutil import rmtree, which
  from .command import Command, default_bin
label_desc: Use image node_id 1 to create a new CMakeDefinition object  with example: obj = CMakeDefinition(source, build_type, generator, definitions, env)