Use GNUInstallDirs for library installation path
This commit is contained in:
parent
d3174bd36c
commit
3285bdc8d8
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
# openscenegraph library configuration
|
||||
${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
|
@ -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@
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user