Skip to content

Commit

Permalink
Automatic snapshot commit from tribits at fd1f66e
Browse files Browse the repository at this point in the history
Origin repo remote tracking branch: 'github/master'
Origin repo remote repo URL: 'github = [email protected]:TriBITSPub/TriBITS.git'

At commit:

commit 6e3d7d2be883b43cbc4dacf27e083f0283ec01b8
Author:  Roscoe A. Bartlett <[email protected]>
Date:    Thu Nov 9 19:39:57 2017 -0700
Summary: Define <Project>_C_Standard as cache var and document (#239)
  • Loading branch information
bartlettroscoe committed Nov 10, 2017
1 parent 5e47efd commit e8ab9eb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ MACRO(TRIBITS_DEFINE_STANDARD_COMPILE_FLAGS_VARS ENABLE_SHADOWING_WARNINGS)
IF (${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS)
SET(C_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS})
ELSE()
IF ("${${PROJECT_NAME}_C_Standard}" STREQUAL "")
SET(${PROJECT_NAME}_C_Standard_USED c99)
ELSE()
SET(${PROJECT_NAME}_C_Standard_USED ${${PROJECT_NAME}_C_Standard})
ENDIF()
MULTILINE_SET(C_STRONG_COMPILE_WARNING_FLAGS
${COMMON_STRONG_COMPILE_WARNING_FLAGS}
" -std=c99" # Check for C99
" -std=${${PROJECT_NAME}_C_Standard_USED}"
)
ENDIF()

Expand Down
8 changes: 8 additions & 0 deletions cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS)
"Enable the C compiler and related code"
${${PROJECT_NAME}_ENABLE_C_DEFAULT} )

IF ("${${PROJECT_NAME}_C_Standard_DEFAULT}" STREQUAL "")
SET(${PROJECT_NAME}_C_Standard_DEFAULT c99)
ENDIF()
ADVANCED_SET(${PROJECT_NAME}_C_Standard
${${PROJECT_NAME}_C_Standard_DEFAULT}
CACHE STRING
"The standard <cstd> to use in --std=<cstd> for GCC compilers." )

IF ("${${PROJECT_NAME}_ENABLE_CXX_DEFAULT}" STREQUAL "")
SET(${PROJECT_NAME}_ENABLE_CXX_DEFAULT ON)
ENDIF()
Expand Down
13 changes: 12 additions & 1 deletion cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7811,6 +7811,7 @@ be documented in `TribitsBuildReference`_.
The global project-level TriBITS options for which defaults can be provided by
a given TriBITS project are:

* `${PROJECT_NAME}_C_Standard`_
* `${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS`_
* `${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND`_
* `${PROJECT_NAME}_CPACK_SOURCE_GENERATOR`_
Expand Down Expand Up @@ -7842,9 +7843,19 @@ a given TriBITS project are:
* `MPI_EXEC_MAX_NUMPROCS`_
* `PythonInterp_FIND_VERSION`_


These options are described below.

.. _${PROJECT_NAME}_C_Standard:

**${PROJECT_NAME}_C_Standard**

The variable ``${PROJECT_NAME}_C_Standard`` is used define the C standard
pass to the compiler in ``--std=<cstd>`` for GCC builds of the project.
TriBITS sets the default as ``c99`` but the project can set a new default in
the project's base `<projectDir>/CMakeLists.txt`_ file with, for example::

SET(${PROJECT_NAME}_C_Standard_DEFAULT c11)

.. _${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS:

**${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS**
Expand Down

0 comments on commit e8ab9eb

Please sign in to comment.