Fix XL compilers on non-AIX machines.

Linking broken on non-AIX machines when using XL compilers due to those
machines not using the CreateExportList tool.  Made use of this tool
conditional on finding it.
This commit is contained in:
Todd Gamblin 2011-08-28 21:58:35 -07:00
parent b17a6dd55b
commit d1697625f8
1 changed files with 15 additions and 10 deletions

View File

@ -35,14 +35,19 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# The compiler front-end passes all object files, archive files, and shared # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
# library files named on the command line to CreateExportList to create a # If we found the tool, we'll use it to create exports, otherwise stick with the regular
# list of all symbols to be exported from the shared library. This causes # create shared library compile line.
# all archive members to be copied into the shared library whether they are if (CMAKE_XL_CreateExportList)
# needed or not. Instead we run the tool ourselves to pass only the object # The compiler front-end passes all object files, archive files, and shared
# files so that we export only the symbols actually provided by the sources. # library files named on the command line to CreateExportList to create a
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY # list of all symbols to be exported from the shared library. This causes
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" # all archive members to be copied into the shared library whether they are
"<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" # needed or not. Instead we run the tool ourselves to pass only the object
) # files so that we export only the symbols actually provided by the sources.
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
"<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
endmacro() endmacro()