Commit e87a175b authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix LTO (aka interprocedural optimization) build with MSVC

Also, disable MSVC LTO for static client libraries - they won't be usable
for end-users.
parent 040069f4
...@@ -370,5 +370,11 @@ ENDFUNCTION() ...@@ -370,5 +370,11 @@ ENDFUNCTION()
FUNCTION (MAYBE_DISABLE_IPO target) FUNCTION (MAYBE_DISABLE_IPO target)
IF(MSVC AND NOT CLANG_CL) IF(MSVC AND NOT CLANG_CL)
SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
IF(CMAKE_CONFIGURATION_TYPES)
FOREACH(cfg ${CMAKE_CONFIGURATION_TYPES})
STRING(TOUPPER "${cfg}" cfg_upper)
SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_${cfg_upper} OFF)
ENDFOREACH()
ENDIF()
ENDIF() ENDIF()
ENDFUNCTION() ENDFUNCTION()
...@@ -40,6 +40,13 @@ SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC) ...@@ -40,6 +40,13 @@ SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC)
MESSAGE("== Configuring MariaDB Connector/C") MESSAGE("== Configuring MariaDB Connector/C")
ADD_SUBDIRECTORY(libmariadb) ADD_SUBDIRECTORY(libmariadb)
IF(MSVC AND TARGET mariadb_obj AND TARGET mariadbclient)
# With MSVC, do not produce LTCG-compiled static client libraries.
# They are not usable by end-users, being tied to exact compiler version
MAYBE_DISABLE_IPO(mariadb_obj)
MAYBE_DISABLE_IPO(mariadbclient)
ENDIF()
IF(UNIX) IF(UNIX)
INSTALL(CODE "EXECUTE_PROCESS( INSTALL(CODE "EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}) COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment