uchardet/test/CMakeLists.txt
Jehan 50bc02c0ff 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.
2017-05-28 15:43:44 +02:00

48 lines
1.2 KiB
CMake

set(
UCHARDET_TEST_SOURCES
uchardet-tests.c
)
add_executable(
uchardet-tests
${UCHARDET_TEST_SOURCES}
)
target_link_libraries(
uchardet-tests
${UCHARDET_LIBRARY}
)
set_target_properties(
uchardet-tests
PROPERTIES
LINKER_LANGUAGE
C
OUTPUT_NAME
uchardet-tests
)
# Iterate through all langs.
file(GLOB dirs "[a-z][a-z]")
foreach(dir ${dirs})
get_filename_component(lang ${dir} NAME)
file(GLOB files "${dir}/*")
# Iterate through all files.
foreach(file ${files})
get_filename_component(charset ${file} NAME_WE)
# These are tests known to fail (not supported or not efficient
# enough). We will have to take a closer look and fix these, but
# there is no need to break the whole `make test` right now,
# which may make actual regressions harder to notice.
if ("${lang}:${charset}" STREQUAL "ja:utf-16le" OR
"${lang}:${charset}" STREQUAL "ja:utf-16be" OR
"${lang}:${charset}" STREQUAL "es:iso-8859-15" OR
"${lang}:${charset}" STREQUAL "da:iso-8859-1" OR
"${lang}:${charset}" STREQUAL "he:iso-8859-8")
message(STATUS "Skipping test ${lang}:${charset} (known broken)")
else()
add_test(NAME "${lang}:${charset}" COMMAND uchardet-tests ${file})
endif()
endforeach()
endforeach()