Do not export all symbols from DLLs on Cygwin

In commit "use export all symbols on cygwin" (2003-01-21) we started
passing -Wl,--export-all-symbols when linking shared libraries.  Now
cygwin exports all symbols automatically if no symbols are explicitly
exported.  When symbols are explicitly exported we want to honor that
narrow interface.  Therefore this flag should not be passed.

Change based on patch from issue #10122.
This commit is contained in:
Brad King 2010-01-21 15:03:32 -05:00
parent 41024b006b
commit 3684f62340
1 changed files with 3 additions and 2 deletions

View File

@ -18,6 +18,7 @@ if(__CYGWIN_COMPILER_GNU)
endif()
set(__CYGWIN_COMPILER_GNU 1)
# TODO: Is -Wl,--enable-auto-import now always default?
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import")
set(CMAKE_CREATE_WIN32_EXE "-mwindows")
@ -44,7 +45,7 @@ macro(__cygwin_compiler_gnu lang)
SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
ENDFOREACH(type)
# To simulate UNIX shared libs we export/import all DLL symbols.
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--export-all-symbols -Wl,--enable-auto-import")
# TODO: Is -Wl,--enable-auto-import now always default?
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")
endmacro()