summaryrefslogtreecommitdiff
path: root/cmake/libutils.cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-05-04 14:17:06 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2020-05-04 14:17:06 +0200
commitd50f776930425e540678238798b4f7666b9cbb76 (patch)
tree63e5c65d22496bc4e8ed35ab04de0251e6711c96 /cmake/libutils.cmake
parentf544a712c8a2ef3f3ecba80cb2782b1839fb36ab (diff)
downloadmariadb-git-d50f776930425e540678238798b4f7666b9cbb76.tar.gz
MDEV-22454 Allow -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
Disable IPO (interprocedural optimization, aka /GL) on Windows on libraries, from which server.dll exports symbols - exporting symbols does not work for objects compiled with /GL.
Diffstat (limited to 'cmake/libutils.cmake')
-rw-r--r--cmake/libutils.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 6b2a2e9b2bb..c7b01bf8429 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -330,3 +330,15 @@ FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}")
ENDIF()
ENDFUNCTION()
+
+# The MSVC /GL flag, used for link-time code generation
+# creates objects files with a format not readable by tools
+# i.e exporting all symbols is not possible with IPO
+# To workaround this, we disable INTERPROCEDURAL_OPTIMIZATION
+# for some static libraries.
+
+FUNCTION (MAYBE_DISABLE_IPO target)
+ IF(MSVC AND NOT CLANG_CL)
+ SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
+ ENDIF()
+ENDFUNCTION()