From Tassilo Glander,"I patched the cmake configuration to support folders, which are really handy to organize the many projects in the OSG solution into examples, applications and core libs in the IDE.

This feature has been introduced to cmake in 2.8.3, on older versions it should be ignored silently. I tested on Visual Studio 2008 with cmake 2.8.3 and 2.8.4.

See the screenshots for comparison [img]osg_solution.png[/img]

This needs few changes:

activate on global cmakelist.txt:

[code]set_property(GLOBAL PROPERTY USE_FOLDERS On)[/code]

set appropriate folder names for project type in osgMacroUtils.cmake:

[code]SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES FOLDER "OSG Core")[/code]

similar for examples, applications"
This commit is contained in:
Robert Osfield 2011-03-09 13:05:59 +00:00
parent 8c7068fdb6
commit 3034ef3473
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,5 @@
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
IF(WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)

View File

@ -92,6 +92,7 @@ MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
IF(OPENSCENEGRAPH_SONAMES)
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
ENDIF(OPENSCENEGRAPH_SONAMES)
ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
@ -110,7 +111,7 @@ ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
MACRO(SETUP_LINK_LIBRARIES)
######################################################################
#
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plagins
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
# they are combined in a single list checked for unicity
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
@ -215,6 +216,8 @@ MACRO(SETUP_LIBRARY LIB_NAME)
ELSE()
SET(TARGET_NAME ${LIB_NAME} )
SET(TARGET_TARGETNAME ${LIB_NAME} )
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES FOLDER "OSG Core")
ADD_LIBRARY(${LIB_NAME}
${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
@ -314,6 +317,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
SETUP_LINK_LIBRARIES()
@ -410,6 +414,8 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications")
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
ELSE(APPLE)
@ -437,6 +443,8 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples")
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
ELSE(APPLE)