endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-
#
# Export DEAL_II_MSVC if we are on a Windows platform:
#
#
# Shared library handling:
#
+ # We disabled dynamic linking on Windows. The *.dll format only allows
+ # up to 65535 objects or members, i.e., it is limited by a 16bit
+ # descriptor. We need more than that for deal.II. For more information,
+ # look up the linker tools error LNK1189.
+ #
+ # Unfortunately, this means that we are stuck with static linking.
+ # As a consequence each binary will be very large, so we also disable
+ # the compilation of examples.
+ #
+ message(WARNING "\n"
+ "BUILD_SHARED_LIBS forced to OFF\n\n"
+ "DEAL_II_COMPILE_EXAMPLES forced to OFF\n\n"
+ )
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
+ set(DEAL_II_COMPILE_EXAMPLES OFF CACHE BOOL "" FORCE)
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- # With MinGW we're lucky:
- enable_if_links(DEAL_II_LINKER_FLAGS "-Wl,--export-all-symbols")
- enable_if_links(DEAL_II_LINKER_FLAGS "-Wl,--enable-auto-import")
- enable_if_links(DEAL_II_LINKER_FLAGS "-Wl,--allow-multiple-definition")
- else()
- # Otherwise disable shared libraries:
- message(WARNING "\n"
- "BUILD_SHARED_LIBS forced to OFF\n\n"
- )
- set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
-
- # And disable compilation of examples:
- set(DEAL_II_COMPILE_EXAMPLES OFF CACHE BOOL "" FORCE)
+ #
+ # In case we find a solution to enable dynamic linking in the future,
+ # we will most probably want to use the CMake infrastructure to
+ # automatically export symbols on Windows targets.
+ #
+ if(BUILD_SHARED_LIBS)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
-
endif()