View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008207CMakeModulespublic2008-12-02 05:092015-11-02 09:15
ReporterTom Vercauteren 
Assigned ToRaffi Enficiaud 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0008207: FindMatlab is not flexible enough - patch included
DescriptionThe current FindMatlab.cmake module has several hard-coded paths that can not be overridden by the user.

Also the current module does not look for the mat library.
Additional InformationAttached is a new version of the FindMatlab.cmake module that looks for the mat library and allows the user to manually specify the MATLAB_ROOT variable.
TagsNo tags attached.
Attached Files? file icon FindMatlab.cmake [^] (3,273 bytes) 2008-12-02 05:09
? file icon FindMatlab-rwp.cmake [^] (4,357 bytes) 2009-01-12 06:00
? file icon MatlabMexMacro.cmake [^] (3,055 bytes) 2010-05-19 05:26
? file icon MatlabMakeMacros.cmake [^] (7,880 bytes) 2011-05-23 11:47

 Relationships

  Notes
(0014528)
RW Penney (reporter)
2009-01-12 06:00

I too have been finding the existing FindMatlab.cmake within cmake-2.4 and cmake-2.6 to be rather restrictive, especially for cross-platform building of mex-files under win32/win64/linux environments.
In parallel with, and independently from Tom, I've been developing an alternative FindMatlab.cmake which I hope could be merged with the good ideas in Tom's scripts for use in a future version of cmake.
(0020739)
mbauman (reporter)
2010-05-14 11:30

rwpenny's marvelous replacement has languished here for over a year. It works very well and is a vast improvement over the default FindMatlab.cmake. I would love to see it incorporated into CMake.
(0020741)
Bill Hoffman (manager)
2010-05-14 15:23

It needs a maintainer:

http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]
(0020790)
Tom Vercauteren (reporter)
2010-05-19 05:26

If a maintainer volunteers, it would also be nice to have a macro to build mex files from cmake. Something along the lines of the attached MatlabMexMacro.cmake should work.
(0026568)
Tom Vercauteren (reporter)
2011-05-23 02:50

This issue is related to bug 0009240
(0026569)
Ramón Casero (reporter)
2011-05-23 11:52
edited on: 2011-05-23 12:00

I have uploaded file MatlabMakeMacros.cmake. This file is a slightly derived work of the Matlab macros found in the source code provided with

Dru F., Fillard P., Vercauteren T., "An ITK Implementation of the Symmetric Log-Domain Diffeomorphic Demons Algorithm", Insight Journal, 2009 Jan-Jun

http://hdl.handle.net/10380/3060 [^]

Our small modification allows to compile a mex file for a Linux 64 bit architecture. Our file lives here

http://code.google.com/p/gerardus/source/browse/tags/release-0.4.0/matlab/MatlabMakeMacros.cmake [^]

The diff of our change is the following:

Index: MatlabMakeMacros.cmake
===================================================================
--- MatlabMakeMacros.cmake (revision 316)
+++ MatlabMakeMacros.cmake (revision 343)
@@ -62,7 +62,13 @@
     SD_APPEND_TARGET_PROPERTIES(${Target} COMPILE_FLAGS ${MATLAB_FLAGS})
     SET_TARGET_PROPERTIES(${Target} PROPERTIES LINK_FLAGS "/export:mexFunction")
   ELSE(MSVC)
- SET(MATLAB_FLAGS "-fPIC" "-D_GNU_SOURCE" "-pthread" "-D_FILE_OFFSET_BITS=64" "-DMX_COMPAT_32")
+ IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
+ SET(MATLAB_FLAGS "-fPIC" "-D_GNU_SOURCE" "-pthread"
+ "-D_FILE_OFFSET_BITS=64" "-DMX_COMPAT_32")
+ ELSE(CMAKE_SIZEOF_VOID_P MATCHES "4")
+ SET(MATLAB_FLAGS "-fPIC" "-D_GNU_SOURCE" "-pthread"
+ "-D_FILE_OFFSET_BITS=64")
+ ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "4")
     SD_APPEND_TARGET_PROPERTIES(${Target} COMPILE_FLAGS ${MATLAB_FLAGS})
     
     IF(APPLE)

(0038758)
Raffi Enficiaud (developer)
2015-05-18 03:42

I believe the FindMatlab refactoring of the current CMake master branch (upcoming v3.3) addresses all those issues.
(0038760)
Brad King (manager)
2015-05-18 09:04

The changes mentioned in 0008207:0038758 are mostly in this commit:

 FindMatlab: Rewrite module and provide a usage API
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49c8dcf7 [^]
(0039812)
Robert Maynard (manager)
2015-11-02 09:15

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2008-12-02 05:09 Tom Vercauteren New Issue
2008-12-02 05:09 Tom Vercauteren File Added: FindMatlab.cmake
2008-12-15 10:50 Bill Hoffman Status new => assigned
2008-12-15 10:50 Bill Hoffman Assigned To => Bill Hoffman
2009-01-12 06:00 RW Penney Note Added: 0014528
2009-01-12 06:00 RW Penney File Added: FindMatlab-rwp.cmake
2010-05-14 11:30 mbauman Note Added: 0020739
2010-05-14 15:23 Bill Hoffman Note Added: 0020741
2010-05-19 05:26 Tom Vercauteren Note Added: 0020790
2010-05-19 05:26 Tom Vercauteren File Added: MatlabMexMacro.cmake
2011-05-23 02:50 Tom Vercauteren Note Added: 0026568
2011-05-23 11:47 Ramón Casero File Added: MatlabMakeMacros.cmake
2011-05-23 11:52 Ramón Casero Note Added: 0026569
2011-05-23 12:00 Ramón Casero Note Edited: 0026569
2015-05-18 03:42 Raffi Enficiaud Note Added: 0038758
2015-05-18 09:04 Brad King Note Added: 0038760
2015-05-18 09:05 Brad King Assigned To Bill Hoffman => Raffi Enficiaud
2015-05-18 09:05 Brad King Status assigned => resolved
2015-05-18 09:05 Brad King Resolution open => fixed
2015-05-18 09:05 Brad King Fixed in Version => CMake 3.3
2015-05-18 09:05 Brad King Target Version => CMake 3.3
2015-11-02 09:15 Robert Maynard Note Added: 0039812
2015-11-02 09:15 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team