From 89ea7a3d3c9487eb33caaedf1b636e0af092dcc2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Mar 2011 11:17:29 -0500 Subject: [PATCH 1/2] Factor AIX and XL compiler flags into common module Factor duplicate flag information from Platform/AIX-XL-*.cmake into Platform/AIX-XL.cmake and load it from the original files. --- Modules/Platform/AIX-XL-C.cmake | 6 ++---- Modules/Platform/AIX-XL-CXX.cmake | 6 ++---- Modules/Platform/AIX-XL-Fortran.cmake | 6 ++---- Modules/Platform/AIX-XL.cmake | 26 ++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 Modules/Platform/AIX-XL.cmake diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake index 2de30d5b7..5e437fafd 100644 --- a/Modules/Platform/AIX-XL-C.cmake +++ b/Modules/Platform/AIX-XL-C.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_C_FLAGS " ") -SET(CMAKE_SHARED_MODULE_C_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(C) diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake index 648cb311b..ef38a5f23 100644 --- a/Modules/Platform/AIX-XL-CXX.cmake +++ b/Modules/Platform/AIX-XL-CXX.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS " ") -SET(CMAKE_SHARED_MODULE_CXX_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(CXX) diff --git a/Modules/Platform/AIX-XL-Fortran.cmake b/Modules/Platform/AIX-XL-Fortran.cmake index 8292e785d..6d4f6559f 100644 --- a/Modules/Platform/AIX-XL-Fortran.cmake +++ b/Modules/Platform/AIX-XL-Fortran.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS " ") -SET(CMAKE_SHARED_MODULE_Fortran_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(Fortran) diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake new file mode 100644 index 000000000..c07f28dba --- /dev/null +++ b/Modules/Platform/AIX-XL.cmake @@ -0,0 +1,26 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_XL) + return() +endif() +set(__AIX_COMPILER_XL 1) + +macro(__aix_compiler_xl lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") + set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") +endmacro() From d30dcf18b9dedcf6744a87793653bc0d94d8a8bb Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Mar 2011 11:17:29 -0500 Subject: [PATCH 2/2] Move RPATH flags to AIX per-compiler information files Move RPATH flags out of Platform/AIX.cmake into platform-specific compiler information files Platform/AIX-XL and Platform/AIX-GNU. The flags need to be set for each compiler of each language. --- Modules/Platform/AIX-GNU.cmake | 2 ++ Modules/Platform/AIX-XL.cmake | 2 ++ Modules/Platform/AIX.cmake | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 79c06baa0..543f3e8cf 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -19,5 +19,7 @@ endif() set(__AIX_COMPILER_GNU 1) macro(__aix_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index c07f28dba..1f9415219 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -19,6 +19,8 @@ endif() set(__AIX_COMPILER_XL 1) macro(__aix_compiler_xl lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index 0ab0cce65..a9f773ed1 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -9,8 +9,6 @@ SET(CMAKE_DL_LIBS "-lld") # When our own RPATH is to be added it may be inserted before the # "always" paths. SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-blibpath:") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # Files named "libfoo.a" may actually be shared libraries. SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)