File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,17 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
37
37
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
38
38
OUTPUT_VARIABLE VERSION_STRING
39
39
OUTPUT_STRIP_TRAILING_WHITESPACE
40
+ ERROR_QUIET
40
41
)
41
42
42
- # If no tags are found, instruct user to fetch them
43
+ # If no tags are found, set version to 0 and show a warning
43
44
if (VERSION_STRING STREQUAL "" )
44
- message (FATAL_ERROR "No git tags found. Run 'git fetch --tags' and try again." )
45
+ set (VERSION_STRING "0.0.0" )
46
+ message (WARNING
47
+ "No git tags found. Version set to 0.0.0.\n "
48
+ "Run 'git fetch --tags' to ensure proper versioning.\n "
49
+ "For more information, see OpenMC developer documentation."
50
+ )
45
51
endif ()
46
52
47
53
# Extract the commit hash
Original file line number Diff line number Diff line change @@ -91,6 +91,30 @@ features and bug fixes. The general steps for contributing are as follows:
91
91
6. After the pull request has been thoroughly vetted, it is merged back into the
92
92
*develop * branch of openmc-dev/openmc.
93
93
94
+ Setting Up Upstream Tracking (Required for Versioning)
95
+ ------------------------------------------------------
96
+
97
+ By default, your fork **does not ** include tags from the upstream OpenMC repository.
98
+ OpenMC relies on `git describe --tags ` for versioning in source builds, and missing tags can lead
99
+ to incorrect version detection (i.e., ``0.0.0 ``). To ensure proper versioning, follow these steps:
100
+
101
+ 1. **Add the Upstream Repository **
102
+ This allows you to fetch updates from the main OpenMC repository.
103
+
104
+ .. code-block :: sh
105
+
106
+ git remote add upstream https://github.com/openmc-dev/openmc.git
107
+
108
+ 2. **Fetch and Push Tags **
109
+ Retrieve tags from the upstream repository and update your fork:
110
+
111
+ .. code-block :: sh
112
+
113
+ git fetch --tags upstream
114
+ git push --tags origin
115
+
116
+ This ensures that both your **local ** and **remote ** fork have the correct versioning information.
117
+
94
118
Private Development
95
119
-------------------
96
120
You can’t perform that action at this time.
0 commit comments