diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f59c968f..e111b2582 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -876,25 +876,16 @@ IF(CYGWIN) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") ENDIF() -IF(UNIX AND NOT WIN32 AND NOT APPLE) - IF(CMAKE_SIZEOF_VOID_P MATCHES "8") - SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement") - MARK_AS_ADVANCED(LIB_POSTFIX) - ENDIF() -ENDIF() -IF(NOT DEFINED LIB_POSTFIX) - SET(LIB_POSTFIX "") -ENDIF() - # Set installation variables +include(GNUInstallDirs) SET(INSTALL_INCDIR include) SET(INSTALL_BINDIR bin) IF(WIN32) SET(INSTALL_LIBDIR bin) SET(INSTALL_ARCHIVEDIR lib) ELSE() - SET(INSTALL_LIBDIR lib${LIB_POSTFIX}) - SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX}) + SET(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) + SET(INSTALL_ARCHIVEDIR ${CMAKE_INSTALL_LIBDIR}) ENDIF() # If the version is equal to or greater than 2.8.8, then we can use the @@ -913,7 +904,7 @@ IF(CMAKE_VERSION VERSION_EQUAL "2.8.8" OR IF(WIN32) SET(INSTALL_CONFIGDIR cmake) ELSE() - SET(INSTALL_CONFIGDIR lib${LIB_POSTFIX}/cmake/OpenSceneGraph) + SET(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenSceneGraph) ENDIF() INCLUDE(CMakePackageConfigHelpers) @@ -945,7 +936,7 @@ ELSE() ENDIF() -SET(INSTALL_PKGCONFIGDIR lib${LIB_POSTFIX}/pkgconfig) +SET(INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # Here we apparently do some funky stuff with making the bin/ and lib/ # folders which is probably needed to work around a very old CMake bug? @@ -1308,7 +1299,7 @@ IF(REQUIRES_LIBPATH_MESSAGE) IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE) SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before") - MESSAGE("\nThe build system is configured to install libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n" + MESSAGE("\nThe build system is configured to install libraries to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\n" "Your applications may not be able to find your installed libraries unless you:\n" " set your LD_LIBRARY_PATH (user specific) or\n" " update your ld.so configuration (system wide)") @@ -1330,12 +1321,12 @@ IF(REQUIRES_LIBPATH_MESSAGE) IF(EXISTS /etc/ld.so.conf) MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n" "that applications find the installed osg libraries, system wide, you\n" - "could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.") + "could add ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} to it.") ENDIF() ENDIF() # emit a message during installation. - INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")") + INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}.\\nYou may need to update your ld.so configuration. \")") ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE) diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake index 923d9f760..b92463350 100644 --- a/CMakeModules/OsgMacroUtils.cmake +++ b/CMakeModules/OsgMacroUtils.cmake @@ -349,7 +349,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) ENDIF() SETUP_LINK_LIBRARIES() -#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS} +#the installation path are differentiated for win32 that install in bib versus other architecture that install in ${CMAKE_INSTALL_LIBDIR}/${OSG_PLUGINS} IF(WIN32) INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT} @@ -362,8 +362,8 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) ELSE(WIN32) INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT} - ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev - LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) ENDIF(WIN32) ENDMACRO(SETUP_PLUGIN) diff --git a/packaging/ld.so.conf.d/openscenegraph.conf.in b/packaging/ld.so.conf.d/openscenegraph.conf.in index 51d1e5a7b..9c1649cef 100644 --- a/packaging/ld.so.conf.d/openscenegraph.conf.in +++ b/packaging/ld.so.conf.d/openscenegraph.conf.in @@ -1,2 +1,2 @@ # openscenegraph library configuration -${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} +${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} diff --git a/packaging/pkgconfig/component.pc.in b/packaging/pkgconfig/component.pc.in index f5b72c32f..7a86032ee 100644 --- a/packaging/pkgconfig/component.pc.in +++ b/packaging/pkgconfig/component.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib@LIB_POSTFIX@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: openscenegraph-@LIB_NAME@ diff --git a/packaging/pkgconfig/openscenegraph.pc.in b/packaging/pkgconfig/openscenegraph.pc.in index 784ac4688..4e972e8e6 100644 --- a/packaging/pkgconfig/openscenegraph.pc.in +++ b/packaging/pkgconfig/openscenegraph.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib@LIB_POSTFIX@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: openscenegraph diff --git a/packaging/pkgconfig/openthreads.pc.in b/packaging/pkgconfig/openthreads.pc.in index 125c4fc7a..82f5a14e5 100644 --- a/packaging/pkgconfig/openthreads.pc.in +++ b/packaging/pkgconfig/openthreads.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib@LIB_POSTFIX@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: openthreads diff --git a/src/OpenThreads/CMakeLists.txt b/src/OpenThreads/CMakeLists.txt index 9cd054381..670135688 100644 --- a/src/OpenThreads/CMakeLists.txt +++ b/src/OpenThreads/CMakeLists.txt @@ -113,4 +113,4 @@ CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openthreads.pc.in @ONLY ) -INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenthreads-dev) +INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT libopenthreads-dev) diff --git a/src/OpenThreads/pthreads/CMakeLists.txt b/src/OpenThreads/pthreads/CMakeLists.txt index b11d5948c..317278526 100644 --- a/src/OpenThreads/pthreads/CMakeLists.txt +++ b/src/OpenThreads/pthreads/CMakeLists.txt @@ -159,8 +159,8 @@ ELSE() INSTALL( TARGETS ${LIB_NAME} EXPORT ${LIB_NAME} - ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev - LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libopenthreads-dev + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libopenthreads RUNTIME DESTINATION bin COMPONENT libopenthreads ) @@ -192,8 +192,8 @@ ELSE() INSTALL( TARGETS ${LIB_NAME} - ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev - LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libopenthreads-dev + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libopenthreads RUNTIME DESTINATION bin COMPONENT libopenthreads ) diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 0829d45ec..14e144699 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -7,7 +7,7 @@ IF (DYNAMIC_OPENSCENEGRAPH) IF(OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS) # Add a default plugin search path component - ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}/${OSG_PLUGINS}\") + ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${OSG_PLUGINS}\") ENDIF() # Set the library extension according to what configuration is being built.