Skip to content

Commit

Permalink
cmake PG: Protect against invalid (old) C/C++ standards
Browse files Browse the repository at this point in the history
  • Loading branch information
cjones051073 committed Jun 14, 2021
1 parent 2ff3c27 commit 0113e7d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _resources/port1.0/group/cmake-1.1.tcl
Expand Up @@ -431,9 +431,19 @@ platform darwin {

# C/C++ standard
if {${compiler.cxx_standard} ne ""} {
# https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html
if {${compiler.c_standard} < 1998} {
compiler.c_standard 1990

This comment has been minimized.

Copy link
@jmroot

jmroot Jun 14, 2021

Member

Shouldn't this be cxx_standard and 1998?

This comment has been minimized.

Copy link
@cjones051073

cjones051073 Jun 14, 2021

Author Member

yep, to fast cut-n-past error... see next commit.

}
configure.args-append -DCMAKE_CXX_STANDARD=[string range ${compiler.cxx_standard} end-1 end]
}
if {${compiler.c_standard} ne ""} {
# Base defaults to 1989 which is not valid as a C standard
# (at least as far as CMake is concerned)
# https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html#prop_tgt:C_STANDARD
if {${compiler.c_standard} < 1990} {
compiler.c_standard 1990
}
configure.args-append -DCMAKE_C_STANDARD=[string range ${compiler.c_standard} end-1 end]
}

Expand Down

0 comments on commit 0113e7d

Please sign in to comment.