kmpkg_cmake_configure
Configure a CMake-based project.
Usage
kmpkg_cmake_configure(
SOURCE_PATH <source-path>
[DISABLE_PARALLEL_CONFIGURE]
[NO_CHARSET_FLAG]
[WINDOWS_USE_MSBUILD]
[GENERATOR <generator>]
[LOGFILE_BASE <logname-base>]
[OPTIONS
<configure-setting>...]
[OPTIONS_RELEASE
<configure-setting>...]
[OPTIONS_DEBUG
<configure-setting>...]
[MAYBE_UNUSED_VARIABLES
<option-name>...]
)
To use this function, you must depend on the helper port kmpkg-cmake:
"dependencies": [
{
"name": "kmpkg-cmake",
"host": true
}
]
Parameters
SOURCE_PATH
Specifies the directory containing the CMakeLists.txt.
This value is usually obtained as a result of calling a source acquisition command like kmpkg_from_github().
DISABLE_PARALLEL_CONFIGURE
Disables running the CMake configure step in parallel.
By default kmpkg disables writing back to the source directory (via the undocumented CMake flag CMAKE_DISABLE_SOURCE_CHANGES) and configures Release and Debug in parallel. This flag instructs kmpkg to allow source directory writes and to execute the configure steps sequentially.
NO_CHARSET_FLAG
Disables passing /utf-8 when using the built-in Windows toolchain.
This is needed for libraries that set their own source code's character set when targeting MSVC. See the MSVC documentation for /utf-8 for more information.
WINDOWS_USE_MSBUILD
Use MSBuild instead of another generator when targeting a Windows platform.
By default kmpkg prefers to use Ninja as the CMake Generator for all platforms. However, there are edge cases where MSBuild has different behavior than Ninja. This flag should only be passed if the project requires MSBuild to build correctly. This flag has no effect for MinGW targets.
GENERATOR
Specifies the CMake generator to use.
By default kmpkg prefers to use Ninja as the CMake Generator for all platforms, or "Unix Makefiles" for non-Windows platforms when Ninja is not available. This parameter can be used for edge cases where project-specific buildsystems depend on a particular generator.
LOGFILE_BASE
An alternate root name for the configure logs.
Defaults to config-${TARGET_TRIPLET}. It should not contain any path separators. Logs will be generated matching the pattern ${CURRENT_BUILDTREES_DIR}/${LOGFILE_BASE}-<suffix>.log
OPTIONS
Additional options to pass to CMake during the configuration.
See also Implicit Options.
OPTIONS_RELEASE
Additional options to pass to CMake during the Release configuration.
These are in addition to OPTIONS.
OPTIONS_DEBUG
Additional options to pass to CMake during the Debug configuration.
These are in addition to OPTIONS.
MAYBE_UNUSED_VARIABLES
List of CMake options that may not be read during the configure step.
kmpkg will warn about any options outside this list that were not read during the CMake configure step. This list should contain options that are only read during certain configurations (such as when KMPKG_LIBRARY_LINKAGE is "static" or when certain features are enabled).
Implicit Options
This command automatically provides several options to CMake.
CMAKE_BUILD_TYPEis set to"Release"or"Debug"as appropriate.BUILD_SHARED_LIBSis set according to the value ofKMPKG_LIBRARY_LINKAGE.CMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}</debug>as appropriate to the configurationCMAKE_TOOLCHAIN_FILEandKMPKG_CHAINLOAD_TOOLCHAIN_FILEare set to include the kmpkg toolchain file and the triplet toolchain.CMAKE_SYSTEM_NAME=${KMPKG_CMAKE_SYSTEM_NAME}. IfKMPKG_CMAKE_SYSTEM_NAMEis unset, defaults to"Windows".CMAKE_SYSTEM_VERSION=${KMPKG_CMAKE_SYSTEM_VERSION}ifKMPKG_CMAKE_SYSTEM_VERSIONis set.CMAKE_EXPORT_NO_PACKAGE_REGISTRY=ONCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ONCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ONCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUECMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ONCMAKE_INSTALL_LIBDIR:STRING=libCMAKE_INSTALL_BINDIR:STRING=binFETCHCONTENT_FULLY_DISCONNECTED=ON(since version 2022-10-30)
This command also passes all options in KMPKG_CMAKE_CONFIGURE_OPTIONS and the configuration-specific options from KMPKG_CMAKE_CONFIGURE_OPTIONS_RELEASE or KMPKG_CMAKE_CONFIGURE_OPTIONS_DEBUG.
Finally, there are additional internal options passed in (with a KMPKG_ prefix) that should not be depended upon.
Examples
kmpkg_from_github(OUT_SOURCE_PATH source_path ...)
kmpkg_cmake_configure(
SOURCE_PATH "${source_path}"
OPTIONS
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTS=OFF
)
kmpkg_cmake_install()
Search kumose/kmpkg for examples
Remarks
This command replaces kmpkg_configure_cmake().