--- flann-1.9.1/src/matlab/CMakeLists.txt.orig 2022-02-16 03:52:57.044244873 +0300 +++ flann-1.9.1/src/matlab/CMakeLists.txt 2022-02-16 04:06:21.398241776 +0300 @@ -16,9 +16,6 @@ find_program(OCT_CMD mkoctfile) -get_property(FLANN_LIB_LOCATION TARGET flann_s PROPERTY LOCATION) -get_filename_component(FLANN_LIB_PATH ${FLANN_LIB_LOCATION} PATH) - if(MEX_CMD AND MEXEXT_CMD) get_filename_component(MEX_REAL_CMD ${MEX_CMD} ABSOLUTE) @@ -48,7 +45,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${MEX_FILE} COMMAND ${MEX_REAL_CMD} - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp -I${PROJECT_SOURCE_DIR}/src/cpp -L${FLANN_LIB_PATH} -lflann_s ${MEX_BUILD_FLAGS} + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp -I${PROJECT_SOURCE_DIR}/src/cpp -L${PROJECT_BINARY_DIR}/lib -lflann_s ${MEX_BUILD_FLAGS} DEPENDS flann_s ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp COMMENT "Building MEX extension ${MEX_FILE}" ) @@ -71,7 +68,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${MEX_FILE} COMMAND ${OCT_CMD} - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp -I${PROJECT_SOURCE_DIR}/src/cpp -L${FLANN_LIB_PATH} -DFLANN_STATIC -lflann_s -lgomp + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp -I${PROJECT_SOURCE_DIR}/src/cpp -L${PROJECT_BINARY_DIR}/lib -DFLANN_STATIC -lflann_s -lgomp DEPENDS flann_s ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp COMMENT "Building MEX extension ${MEX_FILE}" )