Skip to content

Commit dae3e13

Browse files
committed
CMakeLists.txt requires git
#build fix #801
1 parent dada9df commit dae3e13

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ option(MRDOCS_INSTALL "Configure install target" ON)
3636
option(MRDOCS_PACKAGE "Build install package" ON)
3737
option(MRDOCS_BUILD_SHARED "Link shared" ${BUILD_SHARED_LIBS})
3838
option(MRDOCS_BUILD_TESTS "Build tests" ${BUILD_TESTING})
39+
option(MRDOCS_REQUIRE_GIT "Git is required: not being able to extract version build is an error" ON)
3940
if (MRDOCS_BUILD_TESTS OR MRDOCS_INSTALL)
4041
option(MRDOCS_BUILD_DOCS "Build documentation" ON)
4142
else()
@@ -151,8 +152,15 @@ if (GIT_FOUND)
151152
OUTPUT_VARIABLE PROJECT_VERSION_BUILD
152153
OUTPUT_STRIP_TRAILING_WHITESPACE
153154
)
155+
# Check if PROJECT_VERSION_BUILD is populated
156+
if (NOT PROJECT_VERSION_BUILD AND MRDOCS_REQUIRE_GIT)
157+
message(FATAL_ERROR "Git was found but could not extract the version build")
158+
endif()
154159
set(PROJECT_VERSION_BUILD "${PROJECT_VERSION_BUILD}")
155160
else()
161+
if (MRDOCS_REQUIRE_GIT)
162+
message(FATAL_ERROR "Git is required to extract the version build")
163+
endif()
156164
set(PROJECT_VERSION_BUILD "")
157165
endif()
158166
configure_file(

src/lib/Support/Error.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,13 @@ call_impl(
279279
}
280280
os << '\n';
281281
}
282+
283+
// Update counters
282284
std::lock_guard<llvm::sys::Mutex> lock(mutex_);
283-
if(! s.empty())
285+
if (!s.empty())
286+
{
284287
llvm::errs() << s;
288+
}
285289
switch(level)
286290
{
287291
case Level::debug:

0 commit comments

Comments
 (0)