From dc64d8250b686c26a557f58dfad46a0a2101299e Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Mon, 10 Aug 2015 13:21:40 -0400 Subject: [PATCH] HP-UX: Fix linker search type flags for C shared libs on HP-UX Since commit v2.8.7~31^2 (HP: Drive shared library linking with compiler front end, 2011-12-12) the C compiler is used to link shared libraries instead of calling the linker directly, so linker options need to be wrapped as -Wl,-foo instead of -foo. --- Modules/Platform/HP-UX.cmake | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 65cc7310d..581301b76 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -33,18 +33,11 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES # Initialize C and CXX link type selection flags. These flags are # used when building a shared library, shared module, or executable # that links to other libraries to select whether to use the static or -# shared versions of the libraries. Note that C modules and shared -# libs are built using ld directly so we leave off the "-Wl," portion. -foreach(type SHARED_LIBRARY SHARED_MODULE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") -endforeach() -foreach(type EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") -endforeach() +# shared versions of the libraries. foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") + foreach(lang C CXX) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-a,default") + endforeach() endforeach()