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

Set C11 standard in CMake examples #5014

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions HDF5Examples/config/cmake/HDFExampleMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ macro (BASIC_SETTINGS varname)
set (CMAKE_MFC_FLAG 0)
endif ()

set (CMAKE_C_STANDARD 99)
set (CMAKE_C_STANDARD 11)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples need to work for all versions of the library - should this be conditional on the lib version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave it at 99. I don't think the current examples do anything special for C11.

set (CMAKE_C_STANDARD_REQUIRED TRUE)

if (H5EX_BUILD_CPP_LIB)
ENABLE_LANGUAGE (CXX)

set (CMAKE_CXX_STANDARD 98)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
set (CMAKE_CXX_EXTENSIONS OFF)
endif ()
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/HDFCompilerCXXFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98)
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for the library.

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
endif ()
else ()
Expand Down
Loading