Request C++11 standard project-wise and make it a strong requirement.

It is unneeded to do it by target, using the globale property
CMAKE_CXX_STANDARD instead. Also with CMAKE_CXX_STANDARD_REQUIRED, I
make this a strong requirement. The documentation indeed states that the
CXX_STANDARD "is treated as optional and may “decay” to a previous
standard if the requested is not available".
This means that uchardet will likely not be buildable with a compiler
with no C++11 support. But I assume this is not a common situation, and
probably we should not care about outdated compilers. I remain open to
suggestions and disagreement on the topic obviously.
This commit is contained in:
Jehan 2017-05-28 15:38:42 +02:00
parent 1bf198cb0f
commit 50bc02c0ff
4 changed files with 2 additions and 8 deletions

View File

@ -19,6 +19,8 @@ set (
UCHARDET_VERSION
${UCHARDET_VERSION_MAJOR}.${UCHARDET_VERSION_MINOR}.${UCHARDET_VERSION_REVISION}${version_suffix}
)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
######## Windows

View File

@ -79,8 +79,6 @@ add_library(
${UCHARDET_LIBRARY}
${UCHARDET_SOURCES}
)
set_property(TARGET ${UCHARDET_LIBRARY}
PROPERTY CXX_STANDARD 11)
if (UCHARDET_STATIC_LIBRARY)
add_library(
@ -88,8 +86,6 @@ if (UCHARDET_STATIC_LIBRARY)
STATIC
${UCHARDET_SOURCES}
)
set_property(TARGET ${UCHARDET_STATIC_LIBRARY}
PROPERTY CXX_STANDARD 11)
endif (UCHARDET_STATIC_LIBRARY)
set_target_properties(

View File

@ -9,8 +9,6 @@ add_executable(
${UCHARDET_BINARY}
${UCHARDET_SOURCES}
)
set_property(TARGET ${UCHARDET_BINARY}
PROPERTY CXX_STANDARD 11)
target_link_libraries(
${UCHARDET_BINARY}

View File

@ -7,8 +7,6 @@ add_executable(
uchardet-tests
${UCHARDET_TEST_SOURCES}
)
set_property(TARGET uchardet-tests
PROPERTY CXX_STANDARD 11)
target_link_libraries(
uchardet-tests