qibuild.cmake - CMake tools

This module contains function to handle CMake managed project.

qibuild.cmake. get_known_cmake_generators ( )

Get the list of known cmake generators. Assume cmake is in PATH, or path to cmake is correctly configured in ~/.config/qi/qibuild.xml

qibuild.cmake. get_cached_var ( build_dir , var , default=None )

Get a variable from cmake cache :param build_dir: CMakeCache.txt file directory :param var: Requested variable :param default: Default value if not found (default: None) :return: the variable value

qibuild.cmake. cmake ( source_dir , build_dir , cmake_args , env=None , clean_first=True , profiling=False , debug_trycompile=False , trace_cmake=False , summarize_options=False )

Call cmake with from a build dir for a source dir. cmake_args are added on the command line. :param env: defines the environment used when calling cmake

os.environ will remain unchanged
  • clean_first – Clean the cmake cache
  • summarize_options – Whether to call display_options() at the end

For qibuild/CMake hackers: :param profiling: Profile CMake executions :param debug_trycompile: Call cmake with --debug-trycompile :param trace_cmake: Call cmake with --trace The results

will be written in <build>/cmake.log
qibuild.cmake. display_options ( build_dir )

Display the options by looking in the CMake cache.

qibuild.cmake. read_cmake_cache ( cache_path )

Read a CMakeCache.txt file, returning a dict name -> value.

qibuild.cmake. get_cmake_qibuild_dir ( )

Get the path to cmake modules. First, look for a project named qibuild in the worktree, (if a worktree was passed, then, assume we are using qibuild from sources, then assume we are using an installed version of qibuild.

qibuild.cmake. find_installed_cmake_qibuild_dir ( python_dir )

Find CMake QiBuild Dir

qibuild.cmake. get_binutil ( name , cmake_var=None , build_dir=None , env=None )

Get a tool from the binutils package. First, look for it in the CMake cache, else look for it in the system. Note that after a call to CMAKE_FORCE_C_COMPILER() in a CMake toolchain file, CMAKE_AR, CMAKE_OBJDUMP et al. should be correctly set in cache.

qibuild.cmake. check_root_cmake_list ( cmake_list_file )

Check that the root CMakeLists is correct. * It should contain a cmake_minimum_required() line * It should contain a call to project() * If find_package(qibuild) is called, it should be

called after project()
exception qibuild.cmake. IncorrectCMakeLists ( cmake_list_file , message )

IncorrectCMakeLists Exception