AcademySoftwareFoundation / AcademySoftwareFoundation/Imath

CMake - the project is never up-to-date on `IMATH_INSTALL` enabled because of timestamp issues

Open
#437 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
488
Forks
161
Avg merge
1d 3h
Merged PRs (30d)
3

Description

Issue:
- If `IMATH_INSTALL` option is enabled `ZERO_CHECK` target will always rerun CMake when the `Imath` target is requested to be built because the export file seems to be created at configure time as ["dummy file"](https://github.com/AcademySoftwareFoundation/Imath/blob/main/CMakeLists.txt#L71) and later [export](https://github.com/AcademySoftwareFoundation/Imath/blob/a2ef565affca613f354b9d860894c299403664c0/config/CMakeLists.txt#L99) is called causing the file to be overwritten at generate time resulting in incorrect timestamp checks

```bash
1>Build started 9/18/2024 11:47:37 AM.
1>Target PrepareForBuild:
1> Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
1>Target InitializeBuildStatus:
1> Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
1> Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
1>Target PreBuildEvent:
1> Checking File Globs
1>Target CustomBuild:
1> 1>Checking Build System
1> CMake is re-running because D:/repositories/DevshGraphicsProgramming/Nabla/build/dynamic/3rdparty/openexr/CMakeFiles/generate.stamp is out-of-date.
1> the file 'D:/repositories/DevshGraphicsProgramming/Nabla/build/dynamic/3rdparty/imath/config/ImathTargets.cmake'
1> is newer than 'D:/repositories/DevshGraphicsProgramming/Nabla/build/dynamic/3rdparty/openexr/CMakeFiles/generate.stamp.depend'
1> result='-1'
```

Proposed solution:
- remove the ["dummy file"](https://github.com/AcademySoftwareFoundation/Imath/blob/main/CMakeLists.txt#L71) file write request, it's [export](https://cmake.org/cmake/help/latest/command/export.html#export) job to write it

Contributor guide

Open the contributing guide

Research direction

Start with CMakeLists.txt around line 71 and config/CMakeLists.txt around line 99, then reproduce a build with IMATH_INSTALL enabled and the ZERO_CHECK target. Verify that the export file's timestamps no longer make CMake rerun when the Imath target is requested; done means the project remains up-to-date after configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.