Skip to content

Commit b965f19

Browse files
authored
feat: Add CMAKE_SOURCE_DIR parameter to install-remote-tar to support installing projects whose CMakeLists.txt isn't in the root directory. (#72)
1 parent 15df087 commit b965f19

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

exports/taskfiles/utils/cmake.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ tasks:
142142
# @param {string} CMAKE_PACKAGE_NAME CMake package name.
143143
# @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against.
144144
# @param {string} TAR_URL URL of the tar file to download.
145-
# @param {string} WORK_DIR Directory in which to store the build, install, and source directories.
145+
# @param {string} WORK_DIR Directory in which to store the build, install, and extraction
146+
# directories.
146147
#
147148
# CMake parameters
148149
# @param {string[]} [CMAKE_BUILD_ARGS] Any additional arguments to pass to the CMake build
@@ -155,6 +156,8 @@ tasks:
155156
# omitted, the native build tool's default number is used. See `man cmake`.
156157
# @param {string} [CMAKE_SETTINGS_DIR] The directory where the project's CMake settings file
157158
# should be stored.
159+
# @param {string} [CMAKE_SOURCE_DIR=.] The path, within the extraction directory, containing the
160+
# project's top level CMakeLists.txt.
158161
# @param {string[]} [CMAKE_TARGETS] A list of specific targets to build instead of the default
159162
# target.
160163
install-remote-tar:
@@ -172,29 +175,31 @@ tasks:
172175
{{default "" .CMAKE_JOBS}}
173176
CMAKE_SETTINGS_DIR: >-
174177
{{default "" .CMAKE_SETTINGS_DIR}}
178+
CMAKE_SOURCE_DIR: >-
179+
{{default "." .CMAKE_SOURCE_DIR}}
175180
CMAKE_TARGETS:
176181
ref: "default (list) .CMAKE_TARGETS"
177182

178183
# Directory parameters
179184
BUILD_DIR: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-build"
185+
EXTRACTION_DIR: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-extracted"
180186
INSTALL_PREFIX: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-install"
181-
SOURCE_DIR: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-src"
182187

183188
requires:
184189
vars: ["CMAKE_PACKAGE_NAME", "TAR_SHA256", "TAR_URL", "WORK_DIR"]
185190
deps:
186191
- task: "remote:download-and-extract-tar"
187192
vars:
188193
FILE_SHA256: "{{.TAR_SHA256}}"
189-
OUTPUT_DIR: "{{.SOURCE_DIR}}"
194+
OUTPUT_DIR: "{{.EXTRACTION_DIR}}"
190195
URL: "{{.TAR_URL}}"
191196
cmds:
192197
- task: "generate"
193198
vars:
194199
BUILD_DIR: "{{.BUILD_DIR}}"
195200
EXTRA_ARGS:
196201
ref: ".CMAKE_GEN_ARGS"
197-
SOURCE_DIR: "{{.SOURCE_DIR}}"
202+
SOURCE_DIR: "{{.EXTRACTION_DIR}}/{{.CMAKE_SOURCE_DIR}}"
198203
- task: "build"
199204
vars:
200205
BUILD_DIR: "{{.BUILD_DIR}}"

0 commit comments

Comments
 (0)