mirror of https://github.com/OpenVPN/openvpn-gui
CMake: read version from configure.ac
Instead of using hardcoded major/minor version in config-msvc.h, use the values from configure.ac. Signed-off-by: Lev Stipakov <lev@openvpn.net>pull/428/head
parent
438ea865c8
commit
8d878e8f7b
|
@ -25,8 +25,6 @@ add_executable(${PROJECT_NAME} WIN32
|
|||
viewlog.c
|
||||
res/openvpn-gui-res.rc)
|
||||
|
||||
configure_file(config-msvc.h config.h COPYONLY)
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL
|
||||
Wtsapi32.lib
|
||||
|
@ -48,6 +46,17 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
|||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
set(CMAKE_RC_FLAGS "/D \"HAVE_CONFIG_H\" /D \"_MSC_VER\"")
|
||||
|
||||
function(get_version_from_configure regex_arg ret)
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" VERSION_STR REGEX ${regex_arg})
|
||||
string(REGEX MATCH ${regex_arg} VERSION_STR "${VERSION_STR}")
|
||||
set("${ret}" ${CMAKE_MATCH_1} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
get_version_from_configure("_GUI_VERSION_MAJOR\\], \\[([0-9]+)\\]" GUI_VERSION_MAJOR)
|
||||
get_version_from_configure("_GUI_VERSION_MINOR\\], \\[([0-9]+)\\]" GUI_VERSION_MINOR)
|
||||
|
||||
configure_file(config-msvc.h.in config.h)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
_UNICODE
|
||||
UNICODE
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define PACKAGE_VERSION "11"
|
||||
|
||||
/* Version in windows resource format */
|
||||
#define PACKAGE_VERSION_RESOURCE 11,14,0,0
|
||||
#define PACKAGE_VERSION_RESOURCE @GUI_VERSION_MAJOR@,@GUI_VERSION_MINOR@,0,0
|
||||
|
||||
/* Version as a string */
|
||||
#define PACKAGE_VERSION_RESOURCE_STR "11.14.0.0"
|
||||
#define PACKAGE_VERSION_RESOURCE_STR "@GUI_VERSION_MAJOR@.@GUI_VERSION_MINOR@.0.0"
|
Loading…
Reference in New Issue