Skip to content

Commit c5afe84

Browse files
committed
Output timelib version in the configuration log
1 parent 6cb2240 commit c5afe84

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

cmake/ext/date/lib/CMakeLists.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,28 @@ add_subdirectory(lib)
1515

1616
cmake_minimum_required(VERSION 3.25...3.31)
1717

18-
project(timelib LANGUAGES C)
18+
# The timelib version.
19+
block(PROPAGATE timelib_VERSION)
20+
set(
21+
regex
22+
"^[ \t]*#[ \t]*define[ \t]+TIMELIB_ASCII_VERSION[ \t]+\"([0-9.]+)([^\"]*)"
23+
)
24+
file(STRINGS timelib.h _ REGEX "${regex}")
25+
26+
if(CMAKE_VERSION VERSION_LESS 3.29)
27+
string(REGEX MATCH "${regex}" _ "${_}")
28+
endif()
29+
30+
set(timelib_VERSION "${CMAKE_MATCH_1}")
31+
32+
message(STATUS "Configuring timelib ${timelib_VERSION}")
33+
endblock()
34+
35+
project(
36+
timelib
37+
LANGUAGES C
38+
VERSION ${timelib_VERSION}
39+
)
1940

2041
include(CheckIncludeFile)
2142

0 commit comments

Comments
 (0)