Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nils-Arne Dreier
dune-common
Commits
7691b141
Commit
7691b141
authored
9 years ago
by
Christoph Grüninger
Browse files
Options
Downloads
Patches
Plain Diff
[cmake] Fix C++14 flag check for non-compatible STDL
Thanks to Marian for the heads-up and the testing.
parent
9ce8c207
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/modules/CheckCXXFeatures.cmake
+31
-3
31 additions, 3 deletions
cmake/modules/CheckCXXFeatures.cmake
with
31 additions
and
3 deletions
cmake/modules/CheckCXXFeatures.cmake
+
31
−
3
View file @
7691b141
...
...
@@ -24,9 +24,21 @@ if(NOT DISABLE_CXX_VERSION_CHECK)
# try to use compiler flag -std=c++14
include
(
TestCXXAcceptsFlag
)
check_cxx_accepts_flag
(
"-std=c++14"
CXX_FLAG_CXX14
)
include
(
CheckCXXSourceCompiles
)
cmake_push_check_state
()
set
(
CMAKE_REQUIRED_FLAGS
"
${
CMAKE_REQUIRED_FLAGS
}
-std=c++14"
)
check_cxx_source_compiles
(
"
#include <memory>
int main() {
std::make_unique<int>();
}
"
CXX_LIB_SUPPORTS_CXX14
)
cmake_pop_check_state
()
endif
()
if
(
CXX_FLAG_CXX14
)
if
(
CXX_FLAG_CXX14
AND CXX_LIB_SUPPORTS_CXX14
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
CMAKE_REQUIRED_FLAGS
}
-std=c++14"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++14 "
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-std=c++14 "
)
...
...
@@ -38,8 +50,20 @@ else()
if
(
NOT DISABLE_CXX_VERSION_CHECK
)
# try to use compiler flag -std=c++1y for older compilers
check_cxx_accepts_flag
(
"-std=c++1y"
CXX_FLAG_CXX1Y
)
include
(
CheckCXXSourceCompiles
)
cmake_push_check_state
()
set
(
CMAKE_REQUIRED_FLAGS
"
${
CMAKE_REQUIRED_FLAGS
}
-std=c++1y"
)
check_cxx_source_compiles
(
"
#include <memory>
int main() {
std::make_unique<int>();
}
"
CXX_LIB_SUPPORTS_CXX1Y
)
cmake_pop_check_state
()
endif
()
if
(
CXX_FLAG_CXX1Y
)
if
(
CXX_FLAG_CXX1Y
AND CXX_LIB_SUPPORTS_CXX1Y
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
CMAKE_REQUIRED_FLAGS
}
-std=c++1y"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++1y "
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-std=c++1y "
)
...
...
@@ -51,7 +75,9 @@ else()
endif
()
# test for C++11 flags
if
(
NOT
(
DISABLE_CXX_VERSION_CHECK OR CXX_FLAG_CXX14 OR CXX_FLAG_CXX1Y
))
if
(
NOT DISABLE_CXX_VERSION_CHECK
AND
NOT
((
CXX_FLAG_CXX14 AND CXX_LIB_SUPPORTS_CXX14
)
OR
(
CXX_FLAG_CXX1Y AND CXX_LIB_SUPPORTS_CXX1Y
)))
# try to use compiler flag -std=c++11
check_cxx_accepts_flag
(
"-std=c++11"
CXX_FLAG_CXX11
)
...
...
@@ -405,3 +431,5 @@ if(NOT STDTHREAD_WORKS)
"STDTHREAD_LINK_FLAGS. If you think this test is wrong, set the cache "
"variable STDTHREAD_WORKS."
)
endif
(
NOT STDTHREAD_WORKS
)
cmake_pop_check_state
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment