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
Parameters: - build_dir – CMakeCache.txt file directory
- var – Requested variable
- default – Default value if not found (default: None)
Returns: 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.
Parameters: - env – defines the environment used when calling
cmakeos.environwill remain unchanged - clean_first – Clean the cmake cache
- summarize_options – Whether to call
display_options()at the end
For qibuild/CMake hackers:
Parameters: - profiling – Profile CMake executions
- debug_trycompile – Call
cmakewith--debug-trycompile - trace_cmake – Call
cmakewith--traceThe results will be written in <build>/cmake.log
- env – defines the environment used when calling
-
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
worktreewas passed, then, assume we are using qibuild from sources, then assume we are using an installed version of qibuild.
-
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()