Skip to content

Commit 7a89ad5

Browse files
committed
Add hardcoded version support
If can not determine version, this is still better than UNKNOWN
1 parent 0f031e4 commit 7a89ad5

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ else()
6060
endif()
6161

6262
if(NOT SW_VERSION)
63-
set(SW_VERSION "UNKNOWN")
63+
message(WARNING "Version unset, using hardcoded!")
6464
endif()
6565

66-
message(STATUS "Version is set to: ${SW_VERSION}")
67-
6866
# LIBRARY DEPENDENCIES
6967

7068
find_path(LIBCARES_INCLUDE_DIR ares.h)
@@ -110,9 +108,12 @@ set_property(TARGET ${TARGET_NAME} PROPERTY C_STANDARD 11)
110108

111109
define_file_basename_for_sources("https_dns_proxy")
112110

113-
set_source_files_properties(
114-
src/options.c
115-
PROPERTIES COMPILE_FLAGS "-DSW_VERSION='\"${SW_VERSION}\"'")
111+
112+
if(SW_VERSION)
113+
set_source_files_properties(
114+
src/options.c
115+
PROPERTIES COMPILE_FLAGS "-DSW_VERSION='\"${SW_VERSION}\"'")
116+
endif()
116117

117118
if(CLANG_TIDY_EXE)
118119
set_target_properties(

src/options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const char * options_sw_version() {
2222
#ifdef SW_VERSION
2323
return SW_VERSION;
2424
#else
25-
return "UNKNOWN";
25+
return "2023.01.01-atLeast"; // update date sometimes, like 1-2 times a year
2626
#endif
2727
}
2828

0 commit comments

Comments
 (0)