Adjust test names in CMake to be in line with autoconf ones

This commit is contained in:
Mike Gelfand 2017-12-02 17:58:15 +03:00
parent fae6b40002
commit ffcca3964d
1 changed files with 4 additions and 2 deletions

View File

@ -286,9 +286,11 @@ if(ENABLE_TESTS)
session subprocess tr-getopt utils variant watchdir watchdir@generic)
set(TP ${TR_NAME}-test-${T})
if(T MATCHES "^([^@]+)@.+$")
string(REPLACE "@" "_" TP "${TP}")
string(REPLACE "@" "-" TP "${TP}")
string(REPLACE "@" "-" T_NAME "${T}")
set(${TP}_TEST_BASENAME "${CMAKE_MATCH_1}")
else()
set(T_NAME "${T}")
set(${TP}_TEST_BASENAME "${T}")
endif()
add_executable(${TP} ${${TP}_TEST_BASENAME}-test.c ${${T}-test_ADD_SOURCES})
@ -296,7 +298,7 @@ if(ENABLE_TESTS)
if(DEFINED ${T}-test_DEFINITIONS)
target_compile_definitions(${TP} PRIVATE ${${T}-test_DEFINITIONS})
endif()
add_test(NAME ${T} COMMAND ${TP})
add_test(NAME ${T_NAME}-test COMMAND ${TP})
set_property(TARGET ${TP} PROPERTY FOLDER "UnitTests")
endforeach()