Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
227170dc
Commit
227170dc
authored
Aug 03, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Aug 06, 2020
Browse files
fix: better handling of PYBIND11_CPP_STANDARD
parent
c664d557
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
tools/pybind11Tools.cmake
tools/pybind11Tools.cmake
+13
-4
No files found.
tools/pybind11Tools.cmake
View file @
227170dc
...
@@ -25,14 +25,23 @@ include(CheckCXXCompilerFlag)
...
@@ -25,14 +25,23 @@ include(CheckCXXCompilerFlag)
# Warn or error if old variable name used
# Warn or error if old variable name used
if
(
PYBIND11_CPP_STANDARD
)
if
(
PYBIND11_CPP_STANDARD
)
if
(
NOT CMAKE_CXX_STANDARD
)
string
(
REGEX MATCH
[[..$]]
VAL
"
${
PYBIND11_CPP_STANDARD
}
"
)
string
(
REGEX MATCH
[=[..^]=]
VAL
"
${
PYBIND11_CPP_STANDARD
}
"
)
if
(
CMAKE_CXX_STANDARD
)
if
(
NOT CMAKE_CXX_STANDARD STREQUAL VAL
)
message
(
WARNING
"CMAKE_CXX_STANDARD=
${
CMAKE_CXX_STANDARD
}
does not match "
"PYBIND11_CPP_STANDARD=
${
PYBIND11_CPP_STANDARD
}
, "
"please remove PYBIND11_CPP_STANDARD from your cache"
)
endif
()
else
()
set
(
supported_standards 11 14 17 20
)
set
(
supported_standards 11 14 17 20
)
if
(
"
${
VAL
}
"
IN_LIST supported_standards
)
if
(
"
${
VAL
}
"
IN_LIST supported_standards
)
message
(
WARNING
"USE -DCMAKE_CXX_STANDARD=
${
VAL
}
instead of PYBIND11_PYTHON_VERSION"
)
message
(
WARNING
"USE -DCMAKE_CXX_STANDARD=
${
VAL
}
instead of PYBIND11_PYTHON_VERSION"
)
set
(
CMAKE_CXX_STANDARD
${
VAL
}
)
set
(
CMAKE_CXX_STANDARD
${
VAL
}
CACHE STRING
"From PYBIND11_CPP_STANDARD"
)
else
()
else
()
message
(
FATAL_ERROR
"PYBIND11_CPP_STANDARD should be replaced with CMAKE_CXX_STANDARD"
)
message
(
FATAL_ERROR
"PYBIND11_CPP_STANDARD should be replaced with CMAKE_CXX_STANDARD "
"(last two chars:
${
VAL
}
not understood as a valid CXX std)"
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment