From Luigi Calori, improvements to handling of install under Unix

This commit is contained in:
Robert Osfield 2007-03-09 14:54:41 +00:00
parent 6c1b2d29d9
commit 34067a3e02
3 changed files with 29 additions and 4 deletions

View File

@ -124,6 +124,13 @@ ENDIF(NOT APPLE)
SET(CMAKE_DEBUG_POSTFIX "d") SET(CMAKE_DEBUG_POSTFIX "d")
SET(LIB_POSTFIX "")
if (UNIX AND NOT WIN32)
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET(LIB_POSTFIX "64")
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
endif (UNIX AND NOT WIN32)
SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME}) SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
MAKE_DIRECTORY(${OUTPUT_BINDIR}) MAKE_DIRECTORY(${OUTPUT_BINDIR})
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR}) SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})

View File

@ -4,9 +4,15 @@
# ${LIB_NAME} # ${LIB_NAME}
# ${LIB_PUBLIC_HEADERS} # ${LIB_PUBLIC_HEADERS}
SET(INSTALL_BINDIR bin)
SET(INSTALL_INCDIR include) SET(INSTALL_INCDIR include)
SET(INSTALL_LIBDIR lib) SET(INSTALL_BINDIR bin)
IF(WIN32)
SET(INSTALL_LIBDIR bin)
SET(INSTALL_ARCHIVEDIR lib)
ELSE(WIN32)
SET(INSTALL_LIBDIR lib${LIB_POSTFIX})
SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX})
ENDIF(WIN32)
SET(HEADERS_GROUP "Header Files") SET(HEADERS_GROUP "Header Files")
@ -15,6 +21,7 @@ SOURCE_GROUP(
FILES ${LIB_PUBLIC_HEADERS} FILES ${LIB_PUBLIC_HEADERS}
) )
INSTALL( INSTALL(
TARGETS ${LIB_NAME} TARGETS ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} RUNTIME DESTINATION ${INSTALL_BINDIR}

View File

@ -159,6 +159,7 @@ MACRO(ADD_OSG_EXAMPLE SUBDIR)
ENDIF(NOT EXAMPLE_SRC) ENDIF(NOT EXAMPLE_SRC)
SET_TARGET_PROPERTIES(${MYTARGET} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_TARGET_PROPERTIES(${MYTARGET} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
SET_TARGET_PROPERTIES(${MYTARGET} PROPERTIES OUTPUT_NAME ${SUBDIR}) SET_TARGET_PROPERTIES(${MYTARGET} PROPERTIES OUTPUT_NAME ${SUBDIR})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES PROJECT_LABEL "Examples ${MYTARGET}")
#IF(UNIX) #IF(UNIX)
# MESSAGE("so no qui!!!!!!!!!!") # MESSAGE("so no qui!!!!!!!!!!")
FOREACH(LINKLIB osg osgDB osgUtil osgViewer osgText osgGA OpenThreads ${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5}) FOREACH(LINKLIB osg osgDB osgUtil osgViewer osgText osgGA OpenThreads ${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5})
@ -193,7 +194,11 @@ MACRO(ADD_OSG_EXAMPLE SUBDIR)
#MESSAGE(STATUS "adding osg example ${MYTARGET}") #MESSAGE(STATUS "adding osg example ${MYTARGET}")
##INSTALL_TARGETS(/bin ${MYTARGET} ) ##INSTALL_TARGETS(/bin ${MYTARGET} )
INSTALL(TARGETS ${MYTARGET} RUNTIME DESTINATION bin ) IF(WIN32)
INSTALL(TARGETS ${MYTARGET} RUNTIME DESTINATION bin )
ELSE(WIN32)
INSTALL(TARGETS ${MYTARGET} RUNTIME DESTINATION share/OpenSceneGraph/bin )
ENDIF(WIN32)
ENDMACRO(ADD_OSG_EXAMPLE) ENDMACRO(ADD_OSG_EXAMPLE)
@ -222,6 +227,8 @@ MACRO(ADD_OSG_PLUGIN SUBDIR)
IF(NOT MSVC) IF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES DEBUG_POSTFIX "") SET_TARGET_PROPERTIES(${TARGET} PROPERTIES DEBUG_POSTFIX "")
ENDIF(NOT MSVC) ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES PROJECT_LABEL "Plugins ${TARGET}")
FOREACH(LINKLIB osg osgDB osgUtil ${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5}) FOREACH(LINKLIB osg osgDB osgUtil ${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5})
IF(${LINKLIB} MATCHES "osg") IF(${LINKLIB} MATCHES "osg")
#MESSAGE("TARGET_LINK_LIBRARIES(${TARGET} optimized ${LINKLIB}") #MESSAGE("TARGET_LINK_LIBRARIES(${TARGET} optimized ${LINKLIB}")
@ -237,7 +244,11 @@ MACRO(ADD_OSG_PLUGIN SUBDIR)
#speed#TARGET_LOCATIONS_ACCUM(${TARGET}) #speed#TARGET_LOCATIONS_ACCUM(${TARGET})
#old_form#INSTALL_TARGETS(/lib ${TARGET} ) #old_form#INSTALL_TARGETS(/lib ${TARGET} )
INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION bin ) IF(WIN32)
INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION bin )
ELSE(WIN32)
INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/osgPlugin LIBRARY DESTINATION lib${LIB_POSTFIX}/osgPlugin )
ENDIF(WIN32)
ENDMACRO(ADD_OSG_PLUGIN) ENDMACRO(ADD_OSG_PLUGIN)