summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-13 14:59:12 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-11-13 14:59:12 (GMT)
commit558a6f1f920defdfcd7651fba3a85fded84d6a63 (patch)
treef3688cd6f0f4a73a2b8ca6801a6b284f5f90bf12 /Tests
parent978d796e8dbb437ff9ebf34dadb123a9583c6d9b (diff)
parent3bade75b02cd4989d0be5efc6547439eade22be9 (diff)
downloadCMake-558a6f1f920defdfcd7651fba3a85fded84d6a63.zip
CMake-558a6f1f920defdfcd7651fba3a85fded84d6a63.tar.gz
CMake-558a6f1f920defdfcd7651fba3a85fded84d6a63.tar.bz2
Merge topic 'cmake-copyright-year'
3bade75 Help: Parse Copyright.txt instead of using current year 2bbf6bd Copyright.txt: Add test to check year range 3ee67d0 Copyright.txt: Update year range to end in 2013 621ba1f cmake-gui: Parse Copyright.txt instead of duplicating notice 993b685 bootstrap: Parse Copyright.txt instead of duplicating notice
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCopyright.cmake22
-rw-r--r--Tests/CMakeLists.txt3
2 files changed, 25 insertions, 0 deletions
diff --git a/Tests/CMakeCopyright.cmake b/Tests/CMakeCopyright.cmake
new file mode 100644
index 0000000..a7201e9
--- /dev/null
+++ b/Tests/CMakeCopyright.cmake
@@ -0,0 +1,22 @@
+if(CMAKE_VERSION MATCHES "\\.(20[0-9][0-9])[0-9][0-9][0-9][0-9](-|$)")
+ set(version_year "${CMAKE_MATCH_1}")
+ set(copyright_line_regex "^Copyright 2000-(20[0-9][0-9]) Kitware")
+ file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../Copyright.txt" copyright_line
+ LIMIT_COUNT 1 REGEX "${copyright_line_regex}")
+ if(copyright_line MATCHES "${copyright_line_regex}")
+ set(copyright_year "${CMAKE_MATCH_1}")
+ if(copyright_year LESS version_year)
+ message(FATAL_ERROR "Copyright.txt contains\n"
+ " ${copyright_line}\n"
+ "but the current version year is ${version_year}.")
+ else()
+ message(STATUS "PASSED: Copyright.txt contains\n"
+ " ${copyright_line}\n"
+ "and the current version year is ${version_year}.")
+ endif()
+ else()
+ message(FATAL_ERROR "Copyright.txt has no Copyright line of expected format!")
+ endif()
+else()
+ message(STATUS "SKIPPED: CMAKE_VERSION does not know the year: ${CMAKE_VERSION}")
+endif()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index d4a55fc..063ad11 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -161,6 +161,9 @@ if(BUILD_TESTING)
set(CMAKE_LONG_TEST_TIMEOUT 1500)
endif()
+ add_test(NAME CMake.Copyright
+ COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake)
+
# add a bunch of standard build-and-test style tests
ADD_TEST_MACRO(CommandLineTest CommandLineTest)
ADD_TEST_MACRO(FindPackageTest FindPackageTest)