Skip to content

Commit

Permalink
CMakeLists.txt requires git
Browse files Browse the repository at this point in the history
#build

fix #801
  • Loading branch information
alandefreitas committed Jan 16, 2025
1 parent dada9df commit c0f1db5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ jobs:
contents: write

steps:
- name: Install Git
uses: alandefreitas/cpp-actions/package-install@v1.8.8
if: matrix.container != ''
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
with:
apt-get: git

- name: Configure Git Safe Directory
if: matrix.container != ''
run: git config --global --add safe.directory "$(pwd)"

- name: Clone MrDocs
uses: actions/checkout@v4

Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ option(MRDOCS_INSTALL "Configure install target" ON)
option(MRDOCS_PACKAGE "Build install package" ON)
option(MRDOCS_BUILD_SHARED "Link shared" ${BUILD_SHARED_LIBS})
option(MRDOCS_BUILD_TESTS "Build tests" ${BUILD_TESTING})
option(MRDOCS_REQUIRE_GIT "Git is required: not being able to extract version build is an error" ON)
if (MRDOCS_BUILD_TESTS OR MRDOCS_INSTALL)
option(MRDOCS_BUILD_DOCS "Build documentation" ON)
else()
Expand Down Expand Up @@ -151,8 +152,15 @@ if (GIT_FOUND)
OUTPUT_VARIABLE PROJECT_VERSION_BUILD
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check if PROJECT_VERSION_BUILD is populated
if (NOT PROJECT_VERSION_BUILD AND MRDOCS_REQUIRE_GIT)
message(FATAL_ERROR "Git was found but could not extract the version build")
endif()
set(PROJECT_VERSION_BUILD "${PROJECT_VERSION_BUILD}")
else()
if (MRDOCS_REQUIRE_GIT)
message(FATAL_ERROR "Git is required to extract the version build")
endif()
set(PROJECT_VERSION_BUILD "")
endif()
configure_file(
Expand Down
6 changes: 5 additions & 1 deletion src/lib/Support/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,13 @@ call_impl(
}
os << '\n';
}

// Update counters
std::lock_guard<llvm::sys::Mutex> lock(mutex_);
if(! s.empty())
if (!s.empty())
{
llvm::errs() << s;
}
switch(level)
{
case Level::debug:
Expand Down

0 comments on commit c0f1db5

Please sign in to comment.