[CMake] Add compatibility and current versioning to libLTO to match autoconf support.
authorChris Bieneman <beanz@apple.com>
Tue, 13 Oct 2015 22:54:29 +0000 (22:54 +0000)
committerChris Bieneman <beanz@apple.com>
Tue, 13 Oct 2015 22:54:29 +0000 (22:54 +0000)
This also adds LLVM_LTO_VERSION_OFFSET to support functional equivalence to autoconf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250245 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lto/CMakeLists.txt

index c479fa954cb0d61f7a4760faacb13b0b4ebdd16f..e33ef8f37d8b0c54aef953a6f0bdf285a002cc7c 100644 (file)
@@ -19,3 +19,13 @@ add_llvm_library(LTO SHARED ${SOURCES})
 
 install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
   DESTINATION include/llvm-c)
+
+if (APPLE)
+  set(LTO_VERSION ${LLVM_VERSION_MAJOR})
+  if(LLVM_LTO_VERSION_OFFSET)
+    math(EXPR LTO_VERSION "${LLVM_VERSION_MAJOR} + ${LLVM_LTO_VERSION_OFFSET}")
+  endif()
+  set_property(TARGET LTO APPEND_STRING PROPERTY
+              LINK_FLAGS
+              " -compatibility_version 1 -current_version ${LTO_VERSION}.${LLVM_VERSION_MINOR}")
+endif()