# Capture custom step output ExternalProject\_Add

**URL:** https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512
**Category:** Usage
**Created:** [September 19, 2022, 12:07pm UTC](https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512 "2022-09-19T12:07:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Pavel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@Pavel](https://discourse.cmake.org/u/Pavel)
#### Post date: [September 19, 2022, 12:07pm UTC](https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512/1 "2022-09-19T12:07:02Z")

</div>

Hello everyone,

What would be a sane way to capture custom step output ExternalProject\_Add in some cmake variable ?

For example:

```auto
...
ExternalProject_Add(some_autotools_dep
	GIT_REPOSITORY some_dep_url
	GIT_TAG	some_tag
	GIT_SHALLOW ON
	GIT_PROGRESS ON

	CONFIGURE_COMMAND ./configure ...
	BUILD_COMMAND cd <SOURCE_DIR> && make
	INSTALL_COMMAND cd <SOURCE_DIR> && make install
	UPDATE_COMMAND ""
	BUILD_ALWAYS OFF
)

ExternalProject_Add_Step(some_autotools_dep check_upstream_file_sha
  COMMAND	${CMAKE_COMMAND} -E sha512sum some_upstream_file
  DEPENDERS	configure
  WORKING_DIRECTORY <SOURCE_DIR>
  COMMENT "Checking sha..."
  ALWAYS TRUE
)

// At this point I can see my custom step being executed at build stage
// and there is an stdout output of type: 
// <some_hash_string> <some_upstream_file>
...

```

So the idea is to capture \<some\_hash\_string\> to a variable or maybe have some other way to check hash against somehow predetermined value ?

Thanks.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 20, 2022, 11:08pm UTC](https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512/2 "2022-09-20T23:08:48Z")

</div>

Not sure if it is exactly what you need, but check the logging related options (`LOG_CONFIGURE`, `LOG_BUILD`, etc.), maybe also the `LOG_DIR` option if you need to control where the log files are generated.
