From d1697625f8dd279ae5ebd8df887908f28c2f9f40 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 28 Aug 2011 21:58:35 -0700 Subject: [PATCH] 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. --- Modules/Compiler/XL.cmake | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index d07890f39..d2567d513 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 " -E > ") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") - # 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} /objects.exp " - " -Wl,-bE:/objects.exp -o " - ) + # 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} /objects.exp " + " -Wl,-bE:/objects.exp -o " + ) + endif() endmacro()