Replying to myself again, ah the joys of being in a different time zone than the principal developer(s)...

So the options seem to be:
[...]
2. Ask the CMake developers to add a check for Visual Studio Express in
the FindMFC.cmake module. How they would do it, I don't know, neither
do I know how much time that could take.
[...]

Instead of this, I hacked my own FindVCExpress module. This way, the test for including the osgviewerMFC example becomes:

FIND_PACKAGE(MFC) # includes a test for WIN32.
FIND_PACKAGE(VCExpress)
IF (MFC_FOUND AND NOT MSVC80EXPRESS)
    ADD_SUBDIRECTORY(osgviewerMFC)
ENDIF (MFC_FOUND AND NOT MSVC80EXPRESS)

Tested on a machine which has only the Express Edition, and another that has only the Professional Edition. Works as expected in both cases.

One problem would be if both are present, it will not include the MFC example. The workaround is not trivial (look for all other VC++ versions, and if found, keep the MFC example even if Express is also installed). Even then, it's not perfect, because if the generated project files are used in the Express version... So I think not checking that fringe case is good enough for now.

Or maybe we should add an advanced option to force inclusion of the MFC example even if the tests fail?

Comments?

I have attached the modified examples/CMakeLists.txt and the FindVCExpress.cmake module.

Thanks,

J-S
--
______________________________________________________
Jean-Sebastien Guay     [EMAIL PROTECTED]
                        http://whitestar02.webhop.org/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

# Visual C++ Express can be detected by looking for VCExpress.exe in the 
# installation directory instead of devenv.exe. The normal CMake scripts that
# look for Visual C++ 2005 (8.0) look for both executables, but in this case
# we really want to know it's Express and not the other (non-free) editions.
FIND_PROGRAM(VCEXPRESS
  NAMES VCExpress 
  PATHS 
  
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\DevDiv\\VC\\Setup\\VS;EnvironmentDirectory]
  
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]
  "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
  "$ENV{ProgramFiles}/Microsoft Visual Studio 8/Common7/IDE"
  "$ENV{ProgramFiles}/Microsoft Visual Studio8/Common7/IDE"
  "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE"
  "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE"
  "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE"
  "/Program Files/Microsoft Visual Studio 8/Common7/IDE/"
  )
MARK_AS_ADVANCED(VCEXPRESS)
SET(MSVC80EXPRESS 1)
#######################################################
# this are setting used in SETUP_EXAMPLE macro
#######################################################
SET(TARGET_DEFAULT_PREFIX "example_")
SET(TARGET_DEFAULT_LABEL_PREFIX "Examples")

SET(TARGET_COMMON_LIBRARIES 
        OpenThreads
        osg 
        osgDB 
        osgUtil
        osgGA
        osgViewer 
        osgText 
)

ADD_SUBDIRECTORY(osganimate)
ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard)
ADD_SUBDIRECTORY(osgblendequation)
ADD_SUBDIRECTORY(osgcallback)
ADD_SUBDIRECTORY(osgcamera)
ADD_SUBDIRECTORY(osgcatch)
ADD_SUBDIRECTORY(osgclip)
ADD_SUBDIRECTORY(osgcopy)
ADD_SUBDIRECTORY(osgcompositeviewer)
ADD_SUBDIRECTORY(osgcubemap)
ADD_SUBDIRECTORY(osgdelaunay)
ADD_SUBDIRECTORY(osgdepthpartition)
ADD_SUBDIRECTORY(osgdepthshadow)
ADD_SUBDIRECTORY(osgdistortion)
ADD_SUBDIRECTORY(osgfadetext)
ADD_SUBDIRECTORY(osgforest)
ADD_SUBDIRECTORY(osgfxbrowser)
ADD_SUBDIRECTORY(osggeodemo)
ADD_SUBDIRECTORY(osggeometry)
ADD_SUBDIRECTORY(osghangglide)
ADD_SUBDIRECTORY(osghud)
ADD_SUBDIRECTORY(osgimpostor)
ADD_SUBDIRECTORY(osgintersection)
ADD_SUBDIRECTORY(osgkeyboard)
ADD_SUBDIRECTORY(osgkeyboardmouse)
ADD_SUBDIRECTORY(osglauncher)
ADD_SUBDIRECTORY(osglight)
ADD_SUBDIRECTORY(osglightpoint)
ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmotionblur)
ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultitexture)
ADD_SUBDIRECTORY(osgoccluder)
ADD_SUBDIRECTORY(osgpagedlod)
ADD_SUBDIRECTORY(osgparametric)
ADD_SUBDIRECTORY(osgparticle)
ADD_SUBDIRECTORY(osgparticleeffects)
ADD_SUBDIRECTORY(osgphotoalbum)
ADD_SUBDIRECTORY(osgpick)
ADD_SUBDIRECTORY(osgplanets)
ADD_SUBDIRECTORY(osgpoints)
ADD_SUBDIRECTORY(osgpointsprite)
ADD_SUBDIRECTORY(osgprecipitation)
ADD_SUBDIRECTORY(osgprerender)
ADD_SUBDIRECTORY(osgprerendercubemap)
ADD_SUBDIRECTORY(osgreflect)
ADD_SUBDIRECTORY(osgscalarbar)
ADD_SUBDIRECTORY(osgscribe)
ADD_SUBDIRECTORY(osgsequence)
ADD_SUBDIRECTORY(osgshaders)
ADD_SUBDIRECTORY(osgshaderterrain)
ADD_SUBDIRECTORY(osgshadowtexture)
ADD_SUBDIRECTORY(osgshadow)
ADD_SUBDIRECTORY(osgshape)
ADD_SUBDIRECTORY(osgsimplifier)
ADD_SUBDIRECTORY(osgsimulation)
ADD_SUBDIRECTORY(osgterrain)
ADD_SUBDIRECTORY(osgslice)
ADD_SUBDIRECTORY(osgspacewarp)
ADD_SUBDIRECTORY(osgspheresegment)
ADD_SUBDIRECTORY(osgspotlight)
ADD_SUBDIRECTORY(osgstereoimage)
ADD_SUBDIRECTORY(osgteapot)
ADD_SUBDIRECTORY(osgtessellate)#)
ADD_SUBDIRECTORY(osgtext)
ADD_SUBDIRECTORY(osgtexture1D)
ADD_SUBDIRECTORY(osgtexture2D)
ADD_SUBDIRECTORY(osgtexture3D)
ADD_SUBDIRECTORY(osgtexturerectangle)
ADD_SUBDIRECTORY(osgunittests)
ADD_SUBDIRECTORY(osgvertexprogram)
ADD_SUBDIRECTORY(osgvolume)
ADD_SUBDIRECTORY(osgwindows)

IF   (BUILD_OSG_WRAPPERS)
    ADD_SUBDIRECTORY(osgintrospection)
ENDIF(BUILD_OSG_WRAPPERS)

IF   (GLUT_FOUND)
    ADD_SUBDIRECTORY(osgviewerGLUT)
ENDIF(GLUT_FOUND)

IF   (SDL_FOUND)
    ADD_SUBDIRECTORY(osgviewerSDL)
ENDIF(SDL_FOUND)

IF   (wxWidgets_FOUND)
    ADD_SUBDIRECTORY(osgviewerWX)
ENDIF(wxWidgets_FOUND)

IF   (QT_FOUND)
    ADD_SUBDIRECTORY(osgviewerQT)
ENDIF(QT_FOUND)

IF   (FLTK_FOUND)
    ADD_SUBDIRECTORY(osgviewerFLTK)
ENDIF(FLTK_FOUND)

# Really, MFC_FOUND should be false if the compiler is VC++ Express, but 
# that's for the CMake devs to fix... 
# http://www.cmake.org/Bug/bug.php?op=show&bugid=5193
FIND_PACKAGE(MFC)   # includes a test for WIN32.
FIND_PACKAGE(VCExpress)
IF (MFC_FOUND AND NOT MSVC80EXPRESS)
    ADD_SUBDIRECTORY(osgviewerMFC)
ENDIF (MFC_FOUND AND NOT MSVC80EXPRESS)

IF   (NOT DYNAMIC_OPENSCENEGRAPH)
    ADD_SUBDIRECTORY(osgstaticviewer)
ENDIF(NOT DYNAMIC_OPENSCENEGRAPH)

#ADD_SUBDIRECTORY(osgcegui)
#to add subject to find socket#ADD_SUBDIRECTORY(osgcluster)
_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to