Adding Matlab as external library
Posted: Tue Jun 24, 2014 6:44 pm
Hello,
I'm trying to build a new functionality that requires loading Matlab's .MAT file and using Matlab libraries. However, I have a linker problem during compilation process.
My Matlab libraries (libmat.so, libmx.so, etc) are in this folder: /usr/sww/pkg/matlab-R2014a/bin/glnxa64. I suppose I should add this to the CMakeExternalLibs.cmake in trunk. But I don't know how to do it correctly. This is what I added to CMakeExternalLibs.cmake:
However, the result is that:
Please help me with this. Thanks in advance.
I'm trying to build a new functionality that requires loading Matlab's .MAT file and using Matlab libraries. However, I have a linker problem during compilation process.
Code: Select all
[ 45%] Linking CXX executable CloudCompare
Built target QHPR_PLUGIN
[ 47%] Built target QPOISSON_RECON_PLUGIN
[ 54%] Built target QSRA_PLUGIN
[ 56%] Built target QRANSAC_SD_PLUGIN
../CC/libCC_CORE_LIB.so: undefined reference to `matOpen'
collect2: error: ld returned 1 exit status
Code: Select all
# ------------------------------------------------------------------------------
# MATLAB
# ------------------------------------------------------------------------------
find_package ( Matlab REQUIRED )
if( MATLAB_FOUND )
set( MATLAB_ROOT_PATH CACHE PATH "Matlab root directory (i.e. where the 'bin' folder lies)" )
include( ${MATLAB_USE_FILE} )
include_directories(${MATLAB_INCLUDE_DIR})
list( APPEND EXTERNAL_LIBS_INCLUDE_DIR ${MATLAB_INCLUDE_DIR} )
list( APPEND EXTERNAL_LIBS_LIBRARIES ${QT_LIBRARIES} )
else()
message( SEND_ERROR "Matlab required, but not found with 'find_package()'" )
endif()
Code: Select all
CMake Error at CMakeExternalLibs.cmake:105 (message):
Matlab required, but not found with 'find_package()'