diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2011-08-29 04:58:35 (GMT) |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2011-08-29 05:04:41 (GMT) |
commit | d1697625f8dd279ae5ebd8df887908f28c2f9f40 (patch) | |
tree | 45a51a0ba28d0ab4777895a1c6a089d9f1542e95 /Modules/Compiler | |
parent | b17a6dd55b94179fb87f27255f918a7d82ea57e5 (diff) | |
download | CMake-d1697625f8dd279ae5ebd8df887908f28c2f9f40.zip CMake-d1697625f8dd279ae5ebd8df887908f28c2f9f40.tar.gz CMake-d1697625f8dd279ae5ebd8df887908f28c2f9f40.tar.bz2 |
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.
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/XL.cmake | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index d07890f..d2567d5 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -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_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - # The compiler front-end passes all object files, archive files, and shared - # library files named on the command line to CreateExportList to create a - # list of all symbols to be exported from the shared library. This causes - # all archive members to be copied into the shared library whether they are - # 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>" - ) + # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. + # If we found the tool, we'll use it to create exports, otherwise stick with the regular + # create shared library compile line. + if (CMAKE_XL_CreateExportList) + # The compiler front-end passes all object files, archive files, and shared + # library files named on the command line to CreateExportList to create a + # list of all symbols to be exported from the shared library. This causes + # all archive members to be copied into the shared library whether they are + # 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() |