# Variable Slicer\_WC\_LAST\_CHANGED\_DATE is expected to be defined

**URL:** <https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389>\
**Category:** Development\
**Created:** [September 22, 2022, 8:12am UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389 "2022-09-22T08:12:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 8:12am UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/1 "2022-09-22T08:12:42Z")

</div>

Cmake error: Variable Slicer\_WC\_LAST\_CHANGED\_DATE is expected to be defined.

```auto
1>CMake Warning (dev) at CMake/SlicerMacroExtractRepositoryInfo.cmake:87 (message):
1> Skipping repository info extraction: directory [E:/QY3D/Slicer] is not a
1> GIT checkout
1>Call Stack (most recent call first):
1> CMake/SlicerPackageAndUploadTarget.cmake:105 (SlicerMacroExtractRepositoryInfo)
1> CMake/LastConfigureStep/CMakeLists.txt:41 (include)
1>This warning is for project developers. Use -Wno-dev to suppress it.
1>
1>CMake Error at CMake/SlicerPackageAndUploadTarget.cmake:118 (message):
1> Variable Slicer_WC_LAST_CHANGED_DATE is expected to be defined.
1>Call Stack (most recent call first):
1> CMake/LastConfigureStep/CMakeLists.txt:41 (include)
1>
1>
1>-- Configuring incomplete, errors occurred!

```

I found articles about it in the forums, but there doesn’t seem to be a solution

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 22, 2022, 1:59pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/2 "2022-09-22T13:59:44Z")

</div>

Have you downloaded the Slicer source tree az a zip file or you checked out the git repository?

---

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 2:01pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/3 "2022-09-22T14:01:19Z")

</div>

Yes, I deleted the.git file in order to commit the source code to my own Git branch

---

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 2:02pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/4 "2022-09-22T14:02:55Z")

</div>

This is the second time I’ve encountered this problem. The previous time I re-downloaded the Slicer source code, compiled and merged my changes, but it was too time-consuming

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 22, 2022, 2:50pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/5 "2022-09-22T14:50:47Z")

</div>

As a result of deleting the .git file/folder your git repository got corrupted and Slicer’s build system failed to retrieve the required version information. You need to have a valid git repository, or instead you might be able to set the Slicer\_WC\_LAST\_CHANGED (and other CMake variables) manually.

Do you already use the [Slicercustom application template](https://www.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer)? That makes it straightforward to maintain your own customized version of Slicer.

---

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 2:51pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/6 "2022-09-22T14:51:56Z")

</div>

Yes I am using slicerCAT for development

---

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 2:54pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/7 "2022-09-22T14:54:11Z")

</div>

If I want to set the value of Slicer\_WC\_LAST\_CHANGED, how much should I set it to, or what rules should I follow to set these variables

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 22, 2022, 6:13pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/8 "2022-09-22T18:13:57Z")

</div>

> [@miniminic](#):
>
> Yes I am using slicerCAT for development

OK, then all you need to set the `GIT_REPOSITORY` and `GIT_TAG` to your Slicer fork repository and branch/tag here:

> <https://github.com/KitwareMedical/SlicerCAT/blob/e651f197f56e3378ce094378dd29631c08b25a33/CMakeLists.txt#L15-L16>

The build scripts will automatically retrieve all necessary information from there.

---

<div class="post-metadata">

**Author:** ![miniminic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/miniminic/32/16647_2.png) [@miniminic](https://discourse.slicer.org/u/miniminic)\
**Post date:** [September 22, 2022, 11:50pm UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/9 "2022-09-22T23:50:48Z")

</div>

Thank you very much, you solved a lot of my problems

---

<div class="post-metadata">

**Author:** ![ferhue](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ferhue/32/82557_2.png) [@ferhue](https://discourse.slicer.org/u/ferhue)\
**Post date:** [January 29, 2025, 10:40am UTC](https://discourse.slicer.org/t/variable-slicer-wc-last-changed-date-is-expected-to-be-defined/25389/10 "2025-01-29T10:40:57Z")

</div>

The same just happened to me because I had move the git source repo with the sources from HOME to /opt/ and changed the ownership. (So even `git status` here was giving an error)

The error was solved after doing:

```auto
git config --global --add safe.directory /opt/Slicer_src

```
