Skip to content
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

Simplyfy c++ version check #11997

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 2 additions & 13 deletions CMake/lrs_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,10 @@ macro(infoValue variableName)
endmacro()

macro(config_cxx_flags)
include(CheckCXXCompilerFlag)
if(MSVC OR MSVC_IDE)
check_cxx_compiler_flag(/std:c++14 SUPPORTS_CXX14)
else()
check_cxx_compiler_flag(-std=c++14 SUPPORTS_CXX14)
endif()
if( NOT SUPPORTS_CXX14 )
message(FATAL_ERROR "Project '${PROJECT_NAME}' requires C++14 or higher")
endif()
if( NOT CMAKE_CXX_STANDARD )
set( CMAKE_CXX_STANDARD 14 )
endif()
# We require that the current project (e.g., librealsense) use C++14. However, projects using
# the library don't need to be C++14 -- they can use C++11. Hence this is PRIVATE and not PUBLIC:
target_compile_features( ${PROJECT_NAME} PRIVATE cxx_std_${CMAKE_CXX_STANDARD} )
target_compile_features( ${PROJECT_NAME} PRIVATE cxx_std_14 )
target_compile_features( ${PROJECT_NAME} INTERFACE cxx_std_11 )
#set( CMAKE_CUDA_STANDARD ${LRS_CXX_STANDARD} )
endmacro()

Expand Down
2 changes: 2 additions & 0 deletions third-party/realsense-file/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ add_library(${PROJECT_NAME} STATIC
${SOURCE_FILES_COMPRESSION}
)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)

target_include_directories(${PROJECT_NAME} PRIVATE
${ROSBAG_HEADER_DIRS}
${LZ4_INCLUDE_PATH}
Expand Down
1 change: 1 addition & 0 deletions third-party/rsutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project( rsutils )
add_library( ${PROJECT_NAME} STATIC "" )
# We cannot directly interface with nlohmann_json (doesn't work on bionic)
#target_link_libraries( ${PROJECT_NAME} PUBLIC nlohmann_json )
target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_14 )
set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Library )

target_include_directories( ${PROJECT_NAME}
Expand Down