The alternative to this hardcoding is, if the find module is broken for the "standard" system, fix it and submit a patch (a lot are only minimally maintained and most are at least outdated stylewise), or if you know your lib is in a weird place on your system, append that location to CMAKE_PREFIX_PATH when calling cmake, rather than from the build. For matlab, you might consider using my "ProgramFilesGlob.cmake" module to avoid specifying a list of directories that will become outdated - see http://github.com/rpavlik/wiimote-head-tracker-gui/blob/master/cmake/FindParasolid.cmake with one module that uses it here: http://github.com/rpavlik/wiimote-head-tracker-gui/blob/master/cmake/FindJtTk.cmake

Ryan

On 8/6/10 10:34 AM, Brian Davis wrote:
Fails miserably on Win32 (XP), Win7 64, Win Server 2008 64 too. You'll find as I have that the "find whatevers" are not all that they are cracked up to be. CUDA is another example. find_package should really be named attempt_to_find_package_and_when_you_can't_simply_tell_me_the_vars_to_set( package_name )

I have found that FindWhatevers do not allow for a ordered specification of search directories of where the build spec developer believes them to be on their system. If you look into these you will see a set of predefined search directories that when things change are not up to date such as C:\\Program Files\\MATLAB\\R2010a, C:\\Program Files\\MATLAB\\R2009b, etc install dirs.

I have been doing the following:

--snip matlab_config.cmake--
macro( matlab_config )



    message( "MATLAB_INCLUDE_DIR = ${MATLAB_INCLUDE_DIR}" )
    #MATLAB_LIBRARIES
    #MATLAB_MEX_LIBRARY
    #MATLAB_MX_LIBRARY
    #MATLAB_ENG_LIBRARY

    if( BUILD_64BIT )
        set( LIB_DIR win64 )
        message( "BUILDING FOR 64 bit Windows" )

    else(BUILD_64BIT)
        set( LIB_DIR win32 )
        message( "BUILDING FOR 32 bit Windows" )

    endif(BUILD_64BIT)

SET( MATLAB_ROOT_DIR "C:\\Program Files\\MATLAB\\R2010a" CACHE STRING "" ) SET( MATLAB_INCLUDE_DIR "${MATLAB_ROOT_DIR}\\extern\\include" CACHE STRING "" FORCE )

find_library(MATLAB_LIB_DIR libmx.lib PATHS ${MATLAB_ROOT_DIR} ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}/microsoft ) message("MATLAB_LIB_DIR = ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}/microsoft" )
    message( "MATLAB_LIB_DIR = ${MATLAB_LIB_DIR}" )
    message( "matlab lib dir = ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}" )


SET( MATLAB_LIBRARIES ${MATLAB_ROOT_DIR}/bin/${LIB_DIR} CACHE STRING "" FORCE ) SET( MATLAB_MEX_LIBRARY ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}/microsoft CACHE STRING "" FORCE ) SET( MATLAB_MX_LIBRARY ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}/microsoft CACHE STRING "" FORCE ) SET( MATLAB_ENG_LIBRARY ${MATLAB_ROOT_DIR}/extern/lib/${LIB_DIR}/microsoft CACHE STRING "" FORCE )

    INCLUDE_DIRECTORIES( ${MATLAB_INCLUDE_DIR} )

endmacro()


--end snip--

--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

[email protected]
http://academic.cleardefinition.com/

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to