CMakeLists.txt 1013 B

12345678910111213141516171819202122232425262728293031
  1. cmake_minimum_required (VERSION 3.5)
  2. enable_testing()
  3. project(component_checks)
  4. set(MATLAB_FIND_DEBUG TRUE)
  5. if(NOT "${MCR_ROOT}" STREQUAL "")
  6. set(Matlab_ROOT_DIR "${MCR_ROOT}")
  7. if(NOT EXISTS "${MCR_ROOT}")
  8. message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}")
  9. endif()
  10. endif()
  11. # the success of the following command is dependent on the current configuration:
  12. # - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab
  13. # - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab
  14. find_package(Matlab REQUIRED COMPONENTS ENG_LIBRARY MAT_LIBRARY
  15. OPTIONAL_COMPONENTS MAIN_PROGRAM)
  16. message(STATUS "FindMatlab libraries: ${Matlab_LIBRARIES}")
  17. matlab_add_mex(
  18. # target name
  19. NAME cmake_matlab_test_wrapper1
  20. # output name
  21. OUTPUT_NAME cmake_matlab_mex1
  22. SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp
  23. DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt
  24. LINK_TO ${Matlab_LIBRARIES}
  25. )