From b4b52451aeb5f63d47eff4d3812dfef68ada3a20 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 19 Jun 2009 17:09:36 -0400 Subject: [PATCH] BUG: Look in arch-specific HPUX implicit link dirs On HP-UX machines some system libraries appear in architecture-specific implicit linker search paths. We need to add these paths to our system library search path. However, at the time we construct the search path we do not know the target architecture. A full solution requires re-organizing platform configuration files so that the target architecture can be known when needed. Until that happens we can avoid the problem by searching in both 32-bit and 64-bit implicit link directories. By telling CMake that they are implicit directories the generated link lines will never pass the paths, leaving the linker free to find the library of the proper architecture even if the find_library call finds the wrong one. --- Modules/Platform/HP-UX.cmake | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 80896748e..9584cbdbe 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -88,13 +88,19 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX) SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") ENDIF(CMAKE_COMPILER_IS_GNUCXX) # set flags for gcc support -IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) -ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4) - LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) -ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4) INCLUDE(Platform/UnixPaths) +# Look in both 32-bit and 64-bit implict link directories, but tell +# CMake not to pass the paths to the linker. The linker will find the +# library for the proper architecture. In the future we should detect +# which path will be used by the linker. Since the pointer type size +# CMAKE_SIZEOF_VOID_P is not set until after this file executes, we +# would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point +# (after CMakeTest(LANG)Compiler.cmake runs for at least one language). +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /usr/lib/hpux32 /usr/lib/hpux64) IF(NOT CMAKE_COMPILER_IS_GNUCC) SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ")