mirror of https://github.com/getdnsapi/getdns.git
Get CMake build working under MinGW.
The MinGW linker does not like -VERSION: one little bit. I rearranged the order of the ifs hoping that MinGW and friends would be a UNIX, but it was not to be.
This commit is contained in:
parent
ea09baf376
commit
633724327f
|
@ -1,13 +1,6 @@
|
||||||
# Add version to given shared library linkage.
|
# Add version to given shared library linkage.
|
||||||
function(target_shared_library_version lib version_current version_revision version_age)
|
function(target_shared_library_version lib version_current version_revision version_age)
|
||||||
if (WIN32)
|
if (APPLE)
|
||||||
set(rc_template "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/${lib}_version.rc.in")
|
|
||||||
if (EXISTS ${rc_template})
|
|
||||||
configure_file(${rc_template} ${lib}.rc @ONLY)
|
|
||||||
target_sources(${lib} PRIVATE ${lib}.rc)
|
|
||||||
endif ()
|
|
||||||
target_link_libraries(${lib} PRIVATE "-VERSION:${version_current}.${version_revision}")
|
|
||||||
elseif (APPLE)
|
|
||||||
# Follow libtool. Add one to major version, as version 0 doesn't work.
|
# Follow libtool. Add one to major version, as version 0 doesn't work.
|
||||||
# But tag dynlib name with current-age.
|
# But tag dynlib name with current-age.
|
||||||
math(EXPR major_version "${version_current}+1")
|
math(EXPR major_version "${version_current}+1")
|
||||||
|
@ -15,10 +8,17 @@ function(target_shared_library_version lib version_current version_revision vers
|
||||||
set_target_properties(${lib} PROPERTIES VERSION "${dynlib_version}")
|
set_target_properties(${lib} PROPERTIES VERSION "${dynlib_version}")
|
||||||
target_link_libraries(${lib} PRIVATE "-compatibility_version ${major_version}")
|
target_link_libraries(${lib} PRIVATE "-compatibility_version ${major_version}")
|
||||||
target_link_libraries(${lib} PRIVATE "-current_version ${major_version}.${version_revision}")
|
target_link_libraries(${lib} PRIVATE "-current_version ${major_version}.${version_revision}")
|
||||||
elseif (UNIX)
|
elseif (UNIX OR MINGW OR MSYS OR CYGWIN)
|
||||||
# Assume GNU ld, and again follow libtool. Major version is current-age.
|
# Assume GNU ld, and again follow libtool. Major version is current-age.
|
||||||
math(EXPR compat_version "${version_current}-${version_age}")
|
math(EXPR compat_version "${version_current}-${version_age}")
|
||||||
set_target_properties(${lib} PROPERTIES VERSION "${compat_version}.${version_age}.${version_revision}" SOVERSION "${compat_version}")
|
set_target_properties(${lib} PROPERTIES VERSION "${compat_version}.${version_age}.${version_revision}" SOVERSION "${compat_version}")
|
||||||
|
elseif (WIN32)
|
||||||
|
set(rc_template "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/${lib}_version.rc.in")
|
||||||
|
if (EXISTS ${rc_template})
|
||||||
|
configure_file(${rc_template} ${lib}.rc @ONLY)
|
||||||
|
target_sources(${lib} PRIVATE ${lib}.rc)
|
||||||
|
endif ()
|
||||||
|
target_link_libraries(${lib} PRIVATE "-VERSION:${version_current}.${version_revision}")
|
||||||
else ()
|
else ()
|
||||||
message(WARNING "Unknown platform, ${lib} will not be versioned.")
|
message(WARNING "Unknown platform, ${lib} will not be versioned.")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
Loading…
Reference in New Issue