Cmake tests: Allow for comments in control files

Files, which contain names of ctest-tests controling
whether they should be inverted, or ignored.
We have two such files ATM: revertedTests + ignoredTests
This commit is contained in:
Kornel Benko 2013-08-23 20:25:24 +02:00
parent 79f2426386
commit 036a78e990

View File

@ -129,6 +129,21 @@ macro(getreverted testname reverted listreverted)
endif()
endmacro()
macro(loadTestList filename resList)
# Create list of strings from a file without comments
file(STRINGS ${filename} tempList)
set(${resList})
foreach(_l ${tempList})
string(REGEX REPLACE "[ \t]*#.*" "" _newl "${_l}")
if(_newl)
list(APPEND ${resList} "${_newl}")
endif()
endforeach()
endmacro()
loadTestList(revertedTests revertedTests)
loadTestList(ignoredTests ignoredTests)
foreach(libsubfolder doc examples templates)
set(LIBSUB_SRC_DIR "${TOP_SRC_DIR}/lib/${libsubfolder}")
file(GLOB_RECURSE lyx_files RELATIVE "${LIBSUB_SRC_DIR}" "${LIBSUB_SRC_DIR}/*.lyx")
@ -144,8 +159,6 @@ foreach(libsubfolder doc examples templates)
list(APPEND nolang_lyx_files ${f})
endif()
endforeach()
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/revertedTests" revertedTests)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/ignoredTests" ignoredTests)
foreach(f ${nolang_lyx_files} ${lang_lyx_files})
# Strip extension
string(REGEX REPLACE "\\.lyx$" "" f ${f})