-
Notifications
You must be signed in to change notification settings - Fork 856
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
Build error on GCC 4.8.5 #3048
Comments
A current workaround is to add |
As per compiler requirements, gcc 4.8.0 could be the oldest supported from this line and it supports C99. It can be kinda complicated, but I think it's worth it. Do not use |
So |
Hm, if (CMAKE_MAJOR_VERSION LESS 3)
set (FORCE_CXX_STANDARD_GNUONLY 1)
endif()
macro(srt_set_stdcxx targetname spec)
set (stdcxxspec ${spec})
if (NOT "${stdcxxspec}" STREQUAL "")
if (FORCE_CXX_STANDARD_GNUONLY)
target_compile_options(${targetname} PRIVATE -std=c++${stdcxxspec})
message(STATUS "C++ STD: ${targetname}: forced C++${stdcxxspec} standard - GNU option: -std=c++${stdcxxspec}")
else()
set_target_properties(${targetname} PROPERTIES CXX_STANDARD ${stdcxxspec})
message(STATUS "C++ STD: ${targetname}: forced C++${stdcxxspec} standard - portable way")
endif()
else()
message(STATUS "APP: ${targetname}: using default C++ standard")
endif()
endmacro() |
A similar macro to set CSTD standard: macro(srt_set_stdc targetname spec)
set (stdcspec ${spec})
if (NOT "${stdcspec}" STREQUAL "")
if (CMAKE_MAJOR_VERSION LESS 3)
target_compile_options(${targetname} PRIVATE -std=c${stdcspec})
message(STATUS "C STD: ${targetname}: forced C${stdcxxspec} standard - GNU option: -std=c${stdcspec}.")
else()
set_target_properties(${targetname} PROPERTIES C_STANDARD ${stdcspec})
message(STATUS "C STD: ${targetname}: forced C${stdcxxspec} standard - portable way.")
endif()
else()
message(STATUS "APP: ${targetname}: using default C standard.")
endif()
endmacro() |
You can make a common version with additional variable to specify whether C or C++. |
Compiler: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Introduced in PR #2962.
The text was updated successfully, but these errors were encountered: