From 6f61fd0f315cba3af4ba8fd854b49af205625aa3 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Tue, 26 Mar 2019 20:03:05 -0700 Subject: [PATCH] Use CMAKE_CXX_STANDARD instead of open coding it --- CMake/global_config.cmake | 1 + examples/align-advanced/CMakeLists.txt | 15 +-------------- examples/align/CMakeLists.txt | 15 +-------------- examples/callback/CMakeLists.txt | 13 +------------ examples/capture/CMakeLists.txt | 13 +------------ examples/hello-realsense/CMakeLists.txt | 13 +------------ examples/measure/CMakeLists.txt | 13 +------------ examples/motion/CMakeLists.txt | 13 +------------ examples/multicam/CMakeLists.txt | 14 +------------- examples/pointcloud/CMakeLists.txt | 14 +------------- examples/pose-predict/CMakeLists.txt | 13 +------------ examples/pose/CMakeLists.txt | 13 +------------ examples/post-processing/CMakeLists.txt | 13 +------------ examples/record-playback/CMakeLists.txt | 13 +------------ examples/save-to-disk/CMakeLists.txt | 14 +------------- examples/sensor-control/CMakeLists.txt | 14 +------------- examples/software-device/CMakeLists.txt | 10 +--------- examples/trajectory/CMakeLists.txt | 13 +------------ tools/convert/CMakeLists.txt | 16 +--------------- tools/data-collect/CMakeLists.txt | 15 +-------------- tools/depth-quality/CMakeLists.txt | 14 +------------- tools/enumerate-devices/CMakeLists.txt | 15 +-------------- tools/fw-logger/CMakeLists.txt | 15 +-------------- tools/realsense-viewer/CMakeLists.txt | 14 +------------- tools/rosbag-inspector/CMakeLists.txt | 14 +------------- tools/terminal/CMakeLists.txt | 15 +-------------- unit-tests/CMakeLists.txt | 15 +-------------- wrappers/CMakeLists.txt | 15 --------------- wrappers/matlab/CMakeLists.txt | 15 --------------- wrappers/opencv/CMakeLists.txt | 14 -------------- wrappers/opencv/dnn/CMakeLists.txt | 14 +------------- wrappers/opencv/grabcuts/CMakeLists.txt | 14 +------------- wrappers/opencv/imshow/CMakeLists.txt | 14 +------------- wrappers/opencv/kinfu/CMakeLists.txt | 14 +------------- wrappers/opencv/latency-tool/CMakeLists.txt | 14 +------------- wrappers/pcl/CMakeLists.txt | 14 -------------- wrappers/pcl/pcl-color/CMakeLists.txt | 15 +-------------- wrappers/pcl/pcl/CMakeLists.txt | 14 +------------- wrappers/python/CMakeLists.txt | 15 --------------- 39 files changed, 34 insertions(+), 498 deletions(-) diff --git a/CMake/global_config.cmake b/CMake/global_config.cmake index 7fea6b1642..9a0ff4b16f 100644 --- a/CMake/global_config.cmake +++ b/CMake/global_config.cmake @@ -1,5 +1,6 @@ # Save the command line compile commands in the build output set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +set(CMAKE_CXX_STANDARD 11) # View the makefile commands during build #set(CMAKE_VERBOSE_MAKEFILE on) diff --git a/examples/align-advanced/CMakeLists.txt b/examples/align-advanced/CMakeLists.txt index 4fe6c60571..ce2d99dce0 100644 --- a/examples/align-advanced/CMakeLists.txt +++ b/examples/align-advanced/CMakeLists.txt @@ -5,22 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesAlignAdvanced) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) - #align add_executable(rs-align-advanced rs-align-advanced.cpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + set_property(TARGET rs-align-advanced PROPERTY CXX_STANDARD 11) target_link_libraries(rs-align-advanced ${DEPENDENCIES}) include_directories(rs-align-advanced ../../common ../../third-party/imgui) set_target_properties (rs-align-advanced PROPERTIES FOLDER Examples) diff --git a/examples/align/CMakeLists.txt b/examples/align/CMakeLists.txt index 79d7039fe7..1270b29d64 100644 --- a/examples/align/CMakeLists.txt +++ b/examples/align/CMakeLists.txt @@ -5,22 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesAlign) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) - #align add_executable(rs-align rs-align.cpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + set_property(TARGET rs-align PROPERTY CXX_STANDARD 11) target_link_libraries(rs-align ${DEPENDENCIES}) include_directories(rs-align ../../common ../../third-party/imgui) set_target_properties (rs-align PROPERTIES FOLDER Examples) diff --git a/examples/callback/CMakeLists.txt b/examples/callback/CMakeLists.txt index d34e0cf1db..501c049f93 100644 --- a/examples/callback/CMakeLists.txt +++ b/examples/callback/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(rs-callback) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) + set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} ${DEPENDENCIES}) include_directories(${PROJECT_NAME} ../ ../../third-party/tclap/include) set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Examples") diff --git a/examples/capture/CMakeLists.txt b/examples/capture/CMakeLists.txt index f1c139cec5..5af6d40a16 100644 --- a/examples/capture/CMakeLists.txt +++ b/examples/capture/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesCapture) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-capture rs-capture.cpp ../example.hpp) + set_property(TARGET rs-capture PROPERTY CXX_STANDARD 11) target_link_libraries(rs-capture ${DEPENDENCIES}) include_directories(rs-capture ../ ../../third-party/tclap/include) set_target_properties (rs-capture PROPERTIES FOLDER "Examples") diff --git a/examples/hello-realsense/CMakeLists.txt b/examples/hello-realsense/CMakeLists.txt index 75e192c2c0..d3aff88e2e 100644 --- a/examples/hello-realsense/CMakeLists.txt +++ b/examples/hello-realsense/CMakeLists.txt @@ -5,19 +5,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesHelloRealSense) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-hello-realsense rs-hello-realsense.cpp) +set_property(TARGET rs-hello-realsense PROPERTY CXX_STANDARD 11) target_link_libraries(rs-hello-realsense ${DEPENDENCIES}) include_directories(rs-hello-realsense) set_target_properties (rs-hello-realsense PROPERTIES FOLDER "Examples") diff --git a/examples/measure/CMakeLists.txt b/examples/measure/CMakeLists.txt index 13f7785d13..66201dd4f5 100644 --- a/examples/measure/CMakeLists.txt +++ b/examples/measure/CMakeLists.txt @@ -5,23 +5,12 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesMeasure) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-measure rs-measure.cpp ../example.hpp) + set_property(TARGET rs-measure PROPERTY CXX_STANDARD 11) target_link_libraries(rs-measure ${DEPENDENCIES} Threads::Threads) include_directories(rs-measure ../) set_target_properties (rs-measure PROPERTIES FOLDER "Examples") diff --git a/examples/motion/CMakeLists.txt b/examples/motion/CMakeLists.txt index 56fb645054..b99e0f5afa 100644 --- a/examples/motion/CMakeLists.txt +++ b/examples/motion/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesMotion) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-motion rs-motion.cpp ../example.hpp ../../common/res/d435.h ${LZ4_DIR}/lz4.c) + set_property(TARGET rs-motion PROPERTY CXX_STANDARD 11) target_link_libraries(rs-motion ${DEPENDENCIES}) include_directories(../ ../../common/res ${LZ4_DIR}) set_target_properties (rs-motion PROPERTIES FOLDER Examples) diff --git a/examples/multicam/CMakeLists.txt b/examples/multicam/CMakeLists.txt index 85709793db..599040c417 100644 --- a/examples/multicam/CMakeLists.txt +++ b/examples/multicam/CMakeLists.txt @@ -5,21 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesMulticam) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) - # multicam add_executable(rs-multicam rs-multicam.cpp ../example.hpp) + set_property(TARGET rs-multicam PROPERTY CXX_STANDARD 11) include_directories(rs-multicam ../) target_link_libraries(rs-multicam ${DEPENDENCIES}) set_target_properties (rs-multicam PROPERTIES FOLDER Examples) diff --git a/examples/pointcloud/CMakeLists.txt b/examples/pointcloud/CMakeLists.txt index 7a26d1cbb8..3d31cd275d 100644 --- a/examples/pointcloud/CMakeLists.txt +++ b/examples/pointcloud/CMakeLists.txt @@ -5,21 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesPointcloud) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) - #pointcloud add_executable(rs-pointcloud rs-pointcloud.cpp ../example.hpp) + set_property(TARGET rs-pointcloud PROPERTY CXX_STANDARD 11) target_link_libraries(rs-pointcloud ${DEPENDENCIES}) include_directories(rs-pointcloud ../) set_target_properties (rs-pointcloud PROPERTIES FOLDER Examples) diff --git a/examples/pose-predict/CMakeLists.txt b/examples/pose-predict/CMakeLists.txt index 6a5339ba00..b23297fc6e 100644 --- a/examples/pose-predict/CMakeLists.txt +++ b/examples/pose-predict/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesPosePredict) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_EXAMPLES) add_executable(rs-pose-predict rs-pose-predict.cpp) + set_property(TARGET rs-pose-predict PROPERTY CXX_STANDARD 11) target_link_libraries(rs-pose-predict ${DEPENDENCIES}) set_target_properties (rs-pose-predict PROPERTIES FOLDER Examples) install(TARGETS rs-pose-predict RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/examples/pose/CMakeLists.txt b/examples/pose/CMakeLists.txt index 0eb3e2d86e..7e71cabc3a 100644 --- a/examples/pose/CMakeLists.txt +++ b/examples/pose/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesPose) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_EXAMPLES) add_executable(rs-pose rs-pose.cpp) + set_property(TARGET rs-pose PROPERTY CXX_STANDARD 11) target_link_libraries(rs-pose ${DEPENDENCIES}) set_target_properties (rs-pose PROPERTIES FOLDER Examples) install(TARGETS rs-pose RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/examples/post-processing/CMakeLists.txt b/examples/post-processing/CMakeLists.txt index 06ed4e319b..4f6e21a830 100644 --- a/examples/post-processing/CMakeLists.txt +++ b/examples/post-processing/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesPost-Processing) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-post-processing rs-post-processing.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + set_property(TARGET rs-post-processing PROPERTY CXX_STANDARD 11) target_link_libraries(rs-post-processing ${DEPENDENCIES}) include_directories(rs-post-processing ../ ../../third-party/tclap/include ../../third-party/imgui) set_target_properties (rs-post-processing PROPERTIES FOLDER "Examples") diff --git a/examples/record-playback/CMakeLists.txt b/examples/record-playback/CMakeLists.txt index cfe911773e..6c1eb72764 100644 --- a/examples/record-playback/CMakeLists.txt +++ b/examples/record-playback/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesRecord-Playback) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-record-playback rs-record-playback.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + set_property(TARGET rs-record-playback PROPERTY CXX_STANDARD 11) target_link_libraries(rs-record-playback ${DEPENDENCIES}) include_directories(rs-record-playback ../ ../../third-party/tclap/include ../../third-party/imgui) set_target_properties (rs-record-playback PROPERTIES FOLDER "Examples") diff --git a/examples/save-to-disk/CMakeLists.txt b/examples/save-to-disk/CMakeLists.txt index d846367903..d3acea4342 100644 --- a/examples/save-to-disk/CMakeLists.txt +++ b/examples/save-to-disk/CMakeLists.txt @@ -5,20 +5,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesSaveToDisk) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# save-to-disk add_executable(rs-save-to-disk rs-save-to-disk.cpp) +set_property(TARGET rs-save-to-disk PROPERTY CXX_STANDARD 11) target_link_libraries(rs-save-to-disk ${DEPENDENCIES}) include_directories(rs-save-to-disk ../../common ../../third-party ../../third-party/tclap/include) set_target_properties (rs-save-to-disk PROPERTIES FOLDER "Examples") diff --git a/examples/sensor-control/CMakeLists.txt b/examples/sensor-control/CMakeLists.txt index 7da454392a..8f1af64dff 100644 --- a/examples/sensor-control/CMakeLists.txt +++ b/examples/sensor-control/CMakeLists.txt @@ -5,21 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesSensorControl) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) - #sensor-control add_executable(rs-sensor-control api_how_to.h rs-sensor-control.cpp) + set_property(TARGET rs-sensor-control PROPERTY CXX_STANDARD 11) target_link_libraries(rs-sensor-control ${DEPENDENCIES}) include_directories(rs-sensor-control) set_target_properties (rs-sensor-control PROPERTIES FOLDER Examples) diff --git a/examples/software-device/CMakeLists.txt b/examples/software-device/CMakeLists.txt index aedf074719..a5d6de06d5 100644 --- a/examples/software-device/CMakeLists.txt +++ b/examples/software-device/CMakeLists.txt @@ -8,17 +8,9 @@ project(RealsenseExamplesSoftwareDevice) # Save the command line compile commands in the build output set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-software-device rs-software-device.cpp) + set_property(TARGET rs-software-device PROPERTY CXX_STANDARD 11) target_link_libraries(rs-software-device ${DEPENDENCIES}) include_directories(rs-software-device ../ ../../third-party/tclap/include ../../third-party/ ../../common/res) set_target_properties (rs-software-device PROPERTIES FOLDER "Examples") diff --git a/examples/trajectory/CMakeLists.txt b/examples/trajectory/CMakeLists.txt index dc1eb2b224..308969bdef 100644 --- a/examples/trajectory/CMakeLists.txt +++ b/examples/trajectory/CMakeLists.txt @@ -5,20 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesTrajectory) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-trajectory rs-trajectory.cpp ../example.hpp ../../common/res/t265.h ${LZ4_DIR}/lz4.c) + set_property(TARGET rs-trajectory PROPERTY CXX_STANDARD 11) target_link_libraries(rs-trajectory ${DEPENDENCIES}) include_directories(../ ../../common/res ${LZ4_DIR}) set_target_properties (rs-trajectory PROPERTIES FOLDER Examples) diff --git a/tools/convert/CMakeLists.txt b/tools/convert/CMakeLists.txt index fe9d699bbb..ad75b0737a 100644 --- a/tools/convert/CMakeLists.txt +++ b/tools/convert/CMakeLists.txt @@ -6,23 +6,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsConvert) set(RS_TARGET rs-convert) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# convert add_executable(${RS_TARGET} rs-convert.cpp converter.hpp converters/converter-bin.hpp @@ -31,7 +17,7 @@ add_executable(${RS_TARGET} rs-convert.cpp converters/converter-png.hpp converters/converter-raw.hpp ) - +set_property(TARGET ${RS_TARGET} PROPERTY CXX_STANDARD 11) target_link_libraries(${RS_TARGET} ${DEPENDENCIES} Threads::Threads) include_directories(${RS_TARGET} ../../common ../../third-party ../../third-party/tclap/include) diff --git a/tools/data-collect/CMakeLists.txt b/tools/data-collect/CMakeLists.txt index 123fd04c93..f6e7e20846 100644 --- a/tools/data-collect/CMakeLists.txt +++ b/tools/data-collect/CMakeLists.txt @@ -5,21 +5,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsDataCollect) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# data-collect add_executable(rs-data-collect rs-data-collect.h rs-data-collect.cpp) +set_property(TARGET rs-data-collect PROPERTY CXX_STANDARD 11) target_link_libraries(rs-data-collect ${DEPENDENCIES}) include_directories(rs-data-collect ../../common ../../third-party/tclap/include) set_target_properties (rs-data-collect PROPERTIES diff --git a/tools/depth-quality/CMakeLists.txt b/tools/depth-quality/CMakeLists.txt index 4daed19534..5db1c59203 100644 --- a/tools/depth-quality/CMakeLists.txt +++ b/tools/depth-quality/CMakeLists.txt @@ -5,22 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsDepthQuality) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) if(APPLE) @@ -74,6 +61,7 @@ endif() ${CMAKE_CURRENT_SOURCE_DIR}/res/realsense-viewer.rc ../../common/windows-app-bootstrap.cpp) + set_property(TARGET rs-depth-quality PROPERTY CXX_STANDARD 11) source_group("Resources" FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/resource.h ${CMAKE_CURRENT_SOURCE_DIR}/res/realsense-viewer.rc) diff --git a/tools/enumerate-devices/CMakeLists.txt b/tools/enumerate-devices/CMakeLists.txt index 2640435c81..77a7641b77 100644 --- a/tools/enumerate-devices/CMakeLists.txt +++ b/tools/enumerate-devices/CMakeLists.txt @@ -5,21 +5,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseExamplesEnumerateDevices) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# enumerate-devices add_executable(rs-enumerate-devices rs-enumerate-devices.cpp) +set_property(TARGET rs-enumerate-devices PROPERTY CXX_STANDARD 11) target_link_libraries(rs-enumerate-devices ${DEPENDENCIES}) include_directories(rs-enumerate-devices ../../third-party/tclap/include) set_target_properties (rs-enumerate-devices PROPERTIES diff --git a/tools/fw-logger/CMakeLists.txt b/tools/fw-logger/CMakeLists.txt index 1ddb9ffdcc..77dc526328 100644 --- a/tools/fw-logger/CMakeLists.txt +++ b/tools/fw-logger/CMakeLists.txt @@ -5,20 +5,6 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsFirmwareLogger) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# fw-logger add_executable(rs-fw-logger rs-fw-logger.cpp fw-log-data.cpp fw-log-data.h fw-logs-formating-options.cpp @@ -29,6 +15,7 @@ add_executable(rs-fw-logger rs-fw-logger.cpp fw-log-data.cpp fw-logs-xml-helper.h string-formatter.cpp string-formatter.h) +set_property(TARGET rs-fw-logger PROPERTY CXX_STANDARD 11) if(WIN32 OR ANDROID) target_link_libraries(rs-fw-logger ${DEPENDENCIES}) else() diff --git a/tools/realsense-viewer/CMakeLists.txt b/tools/realsense-viewer/CMakeLists.txt index d2dbc8e1ef..c888b357a6 100644 --- a/tools/realsense-viewer/CMakeLists.txt +++ b/tools/realsense-viewer/CMakeLists.txt @@ -5,22 +5,9 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsRealSenseViewer) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) if(APPLE) @@ -92,6 +79,7 @@ endif() include_directories(realsense-viewer ../../third-party/imgui ../../third-party/glad ../../common ../../third-party) endif() + set_property(TARGET realsense-viewer PROPERTY CXX_STANDARD 11) target_link_libraries(realsense-viewer ${DEPENDENCIES} ${GTK3_LIBRARIES} diff --git a/tools/rosbag-inspector/CMakeLists.txt b/tools/rosbag-inspector/CMakeLists.txt index 0161cdf260..d591935916 100644 --- a/tools/rosbag-inspector/CMakeLists.txt +++ b/tools/rosbag-inspector/CMakeLists.txt @@ -5,19 +5,6 @@ cmake_minimum_required(VERSION 2.8.3) project(RealsenseToolsRosbagInspector) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - if(BUILD_GRAPHICAL_EXAMPLES) if(APPLE) @@ -55,6 +42,7 @@ if(BUILD_GRAPHICAL_EXAMPLES) add_executable(rs-rosbag-inspector ${RS_ROSBAG_INSPECTOR_CPP}) include_directories(rs-rosbag-inspector ../../third-party/imgui ../../common ../../third-party) endif() + set_property(TARGET rs-rosbag-inspector PROPERTY CXX_STANDARD 11) target_include_directories(rs-rosbag-inspector PRIVATE ${ROSBAG_HEADER_DIRS} diff --git a/tools/terminal/CMakeLists.txt b/tools/terminal/CMakeLists.txt index 6770920162..a9f1652079 100644 --- a/tools/terminal/CMakeLists.txt +++ b/tools/terminal/CMakeLists.txt @@ -5,21 +5,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseToolsTerminal) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - -# terminal add_executable(rs-terminal rs-terminal.cpp auto-complete.cpp auto-complete.h) +set_property(TARGET rs-terminal PROPERTY CXX_STANDARD 11) if(WIN32 OR ANDROID) target_link_libraries(rs-terminal ${DEPENDENCIES}) else() diff --git a/unit-tests/CMakeLists.txt b/unit-tests/CMakeLists.txt index 6b163a9e0b..009e9a2587 100644 --- a/unit-tests/CMakeLists.txt +++ b/unit-tests/CMakeLists.txt @@ -6,20 +6,6 @@ project(RealsenseUnitTests) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - set(DEPENDENCIES realsense2) set (unit_tests_sources @@ -32,6 +18,7 @@ set (unit_tests_sources ) add_executable(live-test ${unit_tests_sources}) +set_property(TARGET live-test PROPERTY CXX_STANDARD 11) target_link_libraries(live-test ${DEPENDENCIES} Threads::Threads) set_target_properties (live-test PROPERTIES diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index 4f859be18e..f52d15ebab 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -3,21 +3,6 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseWrappers) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - set(DEPENDENCIES realsense2) if (BUILD_PYTHON_BINDINGS OR BUILD_PYTHON_DOCS) diff --git a/wrappers/matlab/CMakeLists.txt b/wrappers/matlab/CMakeLists.txt index dbdd0a56b6..42f81c6e8d 100644 --- a/wrappers/matlab/CMakeLists.txt +++ b/wrappers/matlab/CMakeLists.txt @@ -3,21 +3,6 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseMatlabWrappers) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - find_package(Matlab COMPONENTS MX_LIBRARY MAT_LIBRARY REQUIRED) set(DEPENDENCIES realsense2 ${Matlab_MAT_LIBRARY}) diff --git a/wrappers/opencv/CMakeLists.txt b/wrappers/opencv/CMakeLists.txt index c30b9ed982..e51b910b63 100644 --- a/wrappers/opencv/CMakeLists.txt +++ b/wrappers/opencv/CMakeLists.txt @@ -3,20 +3,6 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsenseCVExamples) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - find_package(OpenCV REQUIRED) set(DEPENDENCIES realsense2 ${OpenCV_LIBS}) diff --git a/wrappers/opencv/dnn/CMakeLists.txt b/wrappers/opencv/dnn/CMakeLists.txt index 8f6e2962ba..98106b1b00 100644 --- a/wrappers/opencv/dnn/CMakeLists.txt +++ b/wrappers/opencv/dnn/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSenseDNNExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-dnn rs-dnn.cpp ../cv-helpers.hpp) +set_property(TARGET rs-dnn PROPERTY CXX_STANDARD 11) target_link_libraries(rs-dnn ${DEPENDENCIES}) set_target_properties (rs-dnn PROPERTIES FOLDER "Examples/OpenCV" diff --git a/wrappers/opencv/grabcuts/CMakeLists.txt b/wrappers/opencv/grabcuts/CMakeLists.txt index e75f60a59e..508bdd74ca 100644 --- a/wrappers/opencv/grabcuts/CMakeLists.txt +++ b/wrappers/opencv/grabcuts/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSenseGrabCutsExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-grabcuts rs-grabcuts.cpp ../cv-helpers.hpp) +set_property(TARGET rs-grabcuts PROPERTY CXX_STANDARD 11) target_link_libraries(rs-grabcuts ${DEPENDENCIES}) set_target_properties (rs-grabcuts PROPERTIES FOLDER "Examples/OpenCV" diff --git a/wrappers/opencv/imshow/CMakeLists.txt b/wrappers/opencv/imshow/CMakeLists.txt index ef8fa15931..d7c45df721 100644 --- a/wrappers/opencv/imshow/CMakeLists.txt +++ b/wrappers/opencv/imshow/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSenseImShowExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-imshow rs-imshow.cpp) +set_property(TARGET rs-imshow PROPERTY CXX_STANDARD 11) target_link_libraries(rs-imshow ${DEPENDENCIES}) set_target_properties (rs-imshow PROPERTIES FOLDER "Examples/OpenCV" diff --git a/wrappers/opencv/kinfu/CMakeLists.txt b/wrappers/opencv/kinfu/CMakeLists.txt index 2b27c68290..8f5b3c2448 100644 --- a/wrappers/opencv/kinfu/CMakeLists.txt +++ b/wrappers/opencv/kinfu/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSenseKinfuExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-kinfu rs-kinfu.cpp ../../../examples/example.hpp) +set_property(TARGET rs-kinfu PROPERTY CXX_STANDARD 11) target_link_libraries(rs-kinfu ${DEPENDENCIES}) include_directories(rs-kinfu ../../../examples) set_target_properties (rs-kinfu PROPERTIES diff --git a/wrappers/opencv/latency-tool/CMakeLists.txt b/wrappers/opencv/latency-tool/CMakeLists.txt index 15ce04ac37..636a6f9cb9 100644 --- a/wrappers/opencv/latency-tool/CMakeLists.txt +++ b/wrappers/opencv/latency-tool/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSenseLatencyToolExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-latency-tool rs-latency-tool.cpp latency-detector.h ../cv-helpers.hpp) +set_property(TARGET rs-latency-tool PROPERTY CXX_STANDARD 11) target_link_libraries(rs-latency-tool ${DEPENDENCIES}) set_target_properties (rs-latency-tool PROPERTIES FOLDER "Examples/OpenCV" diff --git a/wrappers/pcl/CMakeLists.txt b/wrappers/pcl/CMakeLists.txt index ee8095dedb..7472136bba 100644 --- a/wrappers/pcl/CMakeLists.txt +++ b/wrappers/pcl/CMakeLists.txt @@ -3,20 +3,6 @@ cmake_minimum_required(VERSION 3.1.0) project(RealsensePCLExamples) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - find_package( PCL REQUIRED ) if (PCL_FOUND) diff --git a/wrappers/pcl/pcl-color/CMakeLists.txt b/wrappers/pcl/pcl-color/CMakeLists.txt index cedd29140c..47104f5329 100644 --- a/wrappers/pcl/pcl-color/CMakeLists.txt +++ b/wrappers/pcl/pcl-color/CMakeLists.txt @@ -2,21 +2,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSensePCLColorExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable (rs-pcl-color rs-pcl-color.cpp) - +set_property(TARGET rs-pcl-color PROPERTY CXX_STANDARD 11) find_package(PCL REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) diff --git a/wrappers/pcl/pcl/CMakeLists.txt b/wrappers/pcl/pcl/CMakeLists.txt index 8aa22fc41a..44eab458a1 100644 --- a/wrappers/pcl/pcl/CMakeLists.txt +++ b/wrappers/pcl/pcl/CMakeLists.txt @@ -3,20 +3,8 @@ cmake_minimum_required(VERSION 3.1.0) project(RealSensePCLExample) -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - add_executable(rs-pcl rs-pcl.cpp) +set_property(TARGET rs-pcl PROPERTY CXX_STANDARD 11) target_link_libraries(rs-pcl ${DEPENDENCIES}) set_target_properties (rs-pcl PROPERTIES FOLDER "Examples/PCL" diff --git a/wrappers/python/CMakeLists.txt b/wrappers/python/CMakeLists.txt index 06798f77fe..689da81e51 100644 --- a/wrappers/python/CMakeLists.txt +++ b/wrappers/python/CMakeLists.txt @@ -7,21 +7,6 @@ if (NOT BUILD_PYTHON_BINDINGS) message(WARNING "Python Bindings being built despite unset option because they are required for python documentation") endif() -# Save the command line compile commands in the build output -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -# View the makefile commands during build -#set(CMAKE_VERBOSE_MAKEFILE on) - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() - set(DEPENDENCIES realsense2) add_subdirectory(third_party/pybind11)