質問編集履歴

1

CmakeListを追加しました

2020/01/09 06:48

投稿

syo_fr
syo_fr

スコア4

test CHANGED
File without changes
test CHANGED
@@ -265,3 +265,121 @@
265
265
  ### 試したこと
266
266
 
267
267
  Cmakeでコンパイルをしようとしましたがうまくいきませんでした
268
+
269
+ CmakeListsも載せておきます
270
+
271
+
272
+
273
+ ```
274
+
275
+ cmake_minimum_required(VERSION 2.8.3)
276
+
277
+ project(test_opencv)
278
+
279
+
280
+
281
+ find_package(catkin REQUIRED COMPONENTS
282
+
283
+ cv_bridge image_transport roscpp rospy sensor_msgs std_msgs
284
+
285
+ )
286
+
287
+
288
+
289
+ find_package(OpenCV REQUIRED)
290
+
291
+
292
+
293
+ catkin_package(
294
+
295
+ INCLUDE_DIRS
296
+
297
+ LIBRARIES ${PROJECT_NAME}
298
+
299
+ CATKIN_DEPENDS cv_bridge image_transport roscpp rospy sensor_msgs std_msgs
300
+
301
+ DEPENDS
302
+
303
+ )
304
+
305
+
306
+
307
+ include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
308
+
309
+
310
+
311
+ add_executable(test_opencv src/test_opencv.cpp)
312
+
313
+ target_link_libraries(test_opencv ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
314
+
315
+
316
+
317
+ add_executable(opencv_ros src/opencv_ros.cpp)
318
+
319
+ target_link_libraries(opencv_ros ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
320
+
321
+
322
+
323
+ add_executable(test_get_input src/test_get_input.cpp)
324
+
325
+ target_link_libraries(test_get_input ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
326
+
327
+
328
+
329
+ add_executable(test_edge_detection src/test_edge_detection.cpp)
330
+
331
+ target_link_libraries(test_edge_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
332
+
333
+
334
+
335
+ add_executable(test_feature_detection src/test_feature_detection.cpp)
336
+
337
+ target_link_libraries(test_feature_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
338
+
339
+
340
+
341
+ add_executable(test_feature_detection_matching src/test_feature_detection_matching.cpp)
342
+
343
+ target_link_libraries(test_feature_detection_matching ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
344
+
345
+
346
+
347
+ add_executable(test_svm src/test_svm.cpp)
348
+
349
+ target_link_libraries(test_svm ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
350
+
351
+
352
+
353
+ #############
354
+
355
+ ## Install ##
356
+
357
+ #############
358
+
359
+ foreach(dir launch img rviz)
360
+
361
+ install(DIRECTORY ${dir}/
362
+
363
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
364
+
365
+ endforeach(dir)
366
+
367
+
368
+
369
+
370
+
371
+ #############
372
+
373
+ ## Testing ##
374
+
375
+ #############
376
+
377
+ if (CATKIN_ENABLE_TESTING)
378
+
379
+ find_package(roslaunch REQUIRED)
380
+
381
+ roslaunch_add_file_check(launch)
382
+
383
+ endif()
384
+
385
+ ```