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.
This commit is contained in:
Brad King 2009-06-19 17:09:36 -04:00
parent 1beb41a898
commit b4b52451ae
1 changed files with 11 additions and 5 deletions

View File

@ -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 "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")