Skip to content

fix(build): compile cpp targets with cxx_std_11 #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions OpenNI2-FreenectDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# OpenNI2-FreenectDriver
######################################################################################

cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.8.2)

file(GLOB HEADERS src/*.hpp src/*.h)
file(GLOB SOURCES src/*.cpp)
@@ -15,14 +15,14 @@ set_target_properties(FreenectDriver PROPERTIES
VERSION ${PROJECT_VER}
SOVERSION ${PROJECT_APIVER}
OUTPUT_NAME FreenectDriver)

add_definitions(-DPROJECT_VER="${PROJECT_VER}")

include_directories(extern/OpenNI-Linux-x64-2.2.0.33/Include)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/wrappers/cpp)

target_compile_features(FreenectDriver PUBLIC cxx_constexpr)
target_compile_features(FreenectDriver PUBLIC cxx_std_11 cxx_constexpr)

target_link_libraries(FreenectDriver freenectstatic ${MATH_LIB})

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ Notice: If you have the newer Kinect v2 (XBox One), use [OpenKinect/libfreenect2
To build libfreenect, you'll need

- [libusb](http://libusb.info) >= 1.0.18 (Windows needs >= 1.0.22)
- [CMake](http://cmake.org) >= 3.1.0
- [CMake](http://cmake.org) >= 3.8.2
- [python](http://python.org) >= 2.7 or >= 3.3 (only if BUILD_PYTHON=ON or BUILD_PYTHON2=ON or BUILD_PYTHON3=ON or BUILD_REDIST_PACKAGE=OFF)

For the examples, you'll need
6 changes: 4 additions & 2 deletions wrappers/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.1.0)
set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.8.2)

install(FILES libfreenect.hpp
DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
@@ -16,6 +15,9 @@ if (BUILD_EXAMPLES)
add_executable(freenect-cppview cppview.cpp)
add_executable(freenect-cpp_pcview cpp_pc_view.cpp)

target_compile_features(freenect-cppview PUBLIC cxx_std_11)
target_compile_features(freenect-cpp_pcview PUBLIC cxx_std_11)

target_link_libraries(freenect-cppview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-cpp_pcview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})