2020-12-02 05:37:26 +08:00
|
|
|
#[===[.md:
|
|
|
|
# vcpkg_build_ninja
|
|
|
|
|
|
|
|
Build a ninja project
|
|
|
|
|
|
|
|
## Usage:
|
|
|
|
```cmake
|
|
|
|
vcpkg_build_ninja(
|
|
|
|
[TARGETS <target>...]
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters:
|
|
|
|
### TARGETS
|
|
|
|
Only build the specified targets.
|
|
|
|
#]===]
|
2020-05-12 05:58:12 +08:00
|
|
|
|
|
|
|
function(vcpkg_build_ninja)
|
2020-10-27 10:30:27 +08:00
|
|
|
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 0 _vbn "" "" "TARGETS")
|
2020-05-12 05:58:12 +08:00
|
|
|
|
|
|
|
vcpkg_find_acquire_program(NINJA)
|
|
|
|
|
|
|
|
function(build CONFIG)
|
|
|
|
message(STATUS "Building (${CONFIG})...")
|
|
|
|
vcpkg_execute_build_process(
|
|
|
|
COMMAND "${NINJA}" -C "${CURRENT_BUILDTREES_DIR}/${CONFIG}" ${_vbn_TARGETS}
|
|
|
|
WORKING_DIRECTORY "${SOURCE_PATH}"
|
|
|
|
LOGNAME build-${CONFIG}
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
build(${TARGET_TRIPLET}-dbg)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
build(${TARGET_TRIPLET}-rel)
|
|
|
|
endif()
|
2020-12-02 05:37:26 +08:00
|
|
|
endfunction()
|