Commit ebdf90ca authored by Lynn Garren's avatar Lynn Garren

allow -DLIB_SUFFIX=64 and verify that it makes sense

parent b027d0c2
......@@ -4,6 +4,7 @@
# [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel]
# [-DCMAKE_C_COMPILER=...] [-DCMAKE_CXX_COMPILER=...]
# [-DCLHEP_BUILD_DOCS=ON]
# [-DLIB_SUFFIX=64]
# /path/to/source
# make
# make test
......@@ -12,6 +13,9 @@
# mac i386: -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_OSX_ARCHITECTURES="i386"
# mac x86_64: -DCMAKE_CXX_FLAGS="-m64" -DCMAKE_OSX_ARCHITECTURES="x86_64"
#
# Use -DLIB_SUFFIX=64 to install the libraries in a lib64 subdirectory
# instead of the default lib subdirectory.
#
# The default CLHEP build type is CMAKE_BUILD_TYPE=RelWithDebInfo,
# which matches the default CLHEP autoconf flags
#------------------------------------------------------------------------------
......@@ -40,11 +44,14 @@ if(CLHEP_BUILD_DOCS)
message(STATUS "Enabled build and install of documents")
endif()
# enable use of LIB_SUFFIX
include(ClhepVariables)
clhep_lib_suffix()
# CLHEP custom modules
include(ClhepCopyHeaders)
include(ClhepBuildTest)
include(ClhepBuildLibrary)
include(ClhepVariables)
include(CheckFunctionExists)
include(ClhepToolchain)
......
......@@ -2,6 +2,7 @@
2012-08-14 Lynn Garren <garren@fnal.gov>
* cmake/Modules: use OUTPUT_STRIP_TRAILING_WHITESPACE with execute_process commands
* CMakeLists.txt, cmake/Modules: enable -DLIB_SUFFIX=64
2012-08-07 Lynn Garren <garren@fnal.gov>
......
......@@ -41,6 +41,8 @@ make install
-DCMAKE_CXX_COMPILER=...
-DCMAKE_CXX_FLAGS="list_of_flags"
-DLIB_SUFFIX=64 (installs the libraries in a lib64 subdirectory)
#-------------------------------------------------------------
# building documents
#-------------------------------------------------------------
......
......@@ -47,8 +47,8 @@ macro(clhep_build_library package)
# Install the libraries
INSTALL (TARGETS ${package} ${package}S
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib${LIBSUFFIX}
ARCHIVE DESTINATION lib${LIBSUFFIX}
)
endmacro(clhep_build_library)
......@@ -78,22 +78,22 @@ macro(clhep_build_libclhep )
INSTALL(TARGETS CLHEP CLHEPS
EXPORT CLHEPLibraryDepends
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib${LIBSUFFIX}
ARCHIVE DESTINATION lib${LIBSUFFIX}
)
if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
# copy
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/lib\" )" )
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}\" )" )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_shared_symlink
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/bin\" )" )
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin\" )" )
else()
# create the symbolic links
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/lib\" )" )
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}\" )" )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_shared_symlink
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/lib\" )" )
"execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}\" )" )
endif()
INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink )
......
......@@ -63,7 +63,7 @@ export(TARGETS CLHEP CLHEPS
#
set(CLHEP_PKGCONFIG_PREFIX ${PROJECT_BINARY_DIR})
set(CLHEP_PKGCONFIG_INCLUDEDIR ${CLHEP_INCLUDE_DIR})
set(CLHEP_PKGCONFIG_LIBDIR ${PROJECT_BINARY_DIR}/lib)
set(CLHEP_PKGCONFIG_LIBDIR ${PROJECT_BINARY_DIR}/lib${LIBSUFFIX})
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/clhep.pc.in
${PROJECT_BINARY_DIR}/clhep.pc
......@@ -84,7 +84,7 @@ set(CLHEP_DEFINITIONS )
# We use a relative path from the directory where the CLHEPConfig.cmake
# file is installed to the actual include dir.
file(RELATIVE_PATH _relincpath
${CMAKE_INSTALL_PREFIX}/lib/CLHEP-${VERSION}
${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}/CLHEP-${VERSION}
${CMAKE_INSTALL_PREFIX}/include
)
set(CLHEP_INCLUDE_DIR "\${_thisdir}/${_relincpath}")
......@@ -111,7 +111,7 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/CLHEPConfig.cmake.in
# If you later use GNUInstallDirs.cmake, this would need more work to
# ensure accurate calculation of the relative path.
set(CLHEP_PKGCONFIG_PREFIX "\${pcfiledir}/../..")
set(CLHEP_PKGCONFIG_LIBDIR "\${prefix}/lib")
set(CLHEP_PKGCONFIG_LIBDIR "\${prefix}/lib${LIBSUFFIX}")
set(CLHEP_PKGCONFIG_INCLUDEDIR "\${prefix}/include")
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/clhep.pc.in
......@@ -129,16 +129,16 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/clhep.pc.in
install(FILES
${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfigVersion.cmake
${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfig.cmake
DESTINATION lib/CLHEP-${VERSION}
DESTINATION lib${LIBSUFFIX}/CLHEP-${VERSION}
)
install(EXPORT CLHEPLibraryDepends DESTINATION lib/CLHEP-${VERSION})
install(EXPORT CLHEPLibraryDepends DESTINATION lib${LIBSUFFIX}/CLHEP-${VERSION})
# Install the pkg-config file. The choice of 'lib/pkgconfig' for the
# Install the pkg-config file. The choice of 'lib${LIBSUFFIX}/pkgconfig' for the
# installation seems fairly standard.
install(FILES
${PROJECT_BINARY_DIR}/InstallTreeFiles/clhep.pc
DESTINATION lib/pkgconfig
DESTINATION lib${LIBSUFFIX}/pkgconfig
)
# - And we should be done...
......
......@@ -15,6 +15,9 @@
#
# clhep_config():
# processes clhep-config.in
#
# clhep_lib_suffix();
# check for -DLIB_SUFFIX=xxx and process intelligently
macro( clhep_autoconf_variables )
......@@ -124,7 +127,7 @@ endmacro( clhep_package_config_no_lib )
macro( clhep_package_config )
set( ${PACKAGE}_CPPFLAGS "-I${includedir}" )
set( ${PACKAGE}_LDFLAGS "-L\${exec_prefix}/lib" )
set( ${PACKAGE}_LDFLAGS "-L\${exec_prefix}/lib${LIBSUFFIX}" )
set( ${PACKAGE}_LIBS "-lCLHEP-${PACKAGE}-${VERSION}" )
if( ${PACKAGE}_DEPS )
foreach ( dep ${${PACKAGE}_DEPS} )
......@@ -154,3 +157,26 @@ macro( clhep_config )
)
endif()
endmacro( clhep_config )
macro( clhep_lib_suffix )
if(LIB_SUFFIX)
if ( ${LIB_SUFFIX} STREQUAL "64" )
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(LIBSUFFIX ${LIB_SUFFIX})
else()
set(LIBSUFFIX "")
endif()
elseif( ${LIB_SUFFIX} STREQUAL "32" )
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
set(LIBSUFFIX ${LIB_SUFFIX})
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
set(LIBSUFFIX ${LIB_SUFFIX})
else()
set(LIBSUFFIX "")
endif()
else()
set(LIBSUFFIX "")
endif()
endif()
message(STATUS "libraries will be installed in $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}")
endmacro( clhep_lib_suffix )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment