On macOS setting VERSION and/or SOVERSION on MODULE library breaks build
On macOS MODULE
library creates Mach-O binary of type MH_BUNDLE
(by using -bundle
linker options).
Also on macOS setting properties VERSION
and SOVERSION
on MODULE
target adds linker flags -current_version
and -compatibility_version
. However, -current_version
and -compatibility_version
can be used only for -dylib
binaries (i.e. CMake SHARED
libraries). Thus, the following code fails to build:
add_library(foo MODULE)
set_property(TARGET foo PROPERTY VERSION 1.0)
set_property(TARGET foo PROPERTY SOVERSION 1.0)
CMake should not try to set -current_version
and/or -compatibility_version
for MODULE
target when user sets VERSION
and/or SOVERSION
properties on it.
Edited by Paul