Skip to content

refactor(taskfiles)!: Rename NAME to CMAKE_PACKAGE_NAME and require it to be set if CMAKE_SETTINGS_DIR is set in utils:cmake:install (fixes #50). #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions exports/taskfiles/utils/cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ tasks:
#
# @param {string} BUILD_DIR Directory containing the completed build to use.
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string} NAME CMake project name (used in directory names and the CMake settings file).
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command.
# @param {string} [NAME] CMake project name (used in directory names and the CMake settings file).
# Required if `CMAKE_SETTINGS_DIR` is set.
install:
internal: true
label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}-{{.EXTRA_ARGS}}"
Expand All @@ -107,7 +108,15 @@ tasks:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
requires:
vars: ["BUILD_DIR", "INSTALL_PREFIX", "NAME"]
vars: ["BUILD_DIR", "INSTALL_PREFIX"]
preconditions:
- sh: >-
{{if .CMAKE_SETTINGS_DIR}}
{{not (empty .NAME)}}
{{end}}
msg: |-
NAME must be set if CMAKE_SETTINGS_DIR is set.
CMAKE_SETTINGS_DIR: {{.CMAKE_SETTINGS_DIR}}
cmds:
- >-
cmake
Expand Down Expand Up @@ -144,8 +153,8 @@ tasks:
# command.
# @param {int} [CMAKE_JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the native build tool's default number is used. See `man cmake`.
# @param {string} [CMAKE_SETTINGS_DIR={{.WORK_DIR}}/cmake-settings] The directory where the
# project's CMake settings file should be stored.
# @param {string} [CMAKE_SETTINGS_DIR] The directory where the project's CMake settings file
# should be stored.
# @param {string[]} [CMAKE_TARGETS] A list of specific targets to build instead of the default
# target.
install-remote-tar:
Expand All @@ -162,7 +171,7 @@ tasks:
CMAKE_JOBS: >-
{{default "" .CMAKE_JOBS}}
CMAKE_SETTINGS_DIR: >-
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}}
{{default "" .CMAKE_SETTINGS_DIR}}
CMAKE_TARGETS:
ref: "default (list) .CMAKE_TARGETS"

Expand Down