diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-06-17 18:31:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-21 15:06:39 (GMT) |
commit | f0a89149bc569020e281c5908733bf4b7eeddf15 (patch) | |
tree | 627b30ee8dee5645c1b65735b39ca240e093730c | |
parent | 6425a5f3a06459914cca17172e2b6f557e7d79a4 (diff) | |
download | CMake-f0a89149bc569020e281c5908733bf4b7eeddf15.zip CMake-f0a89149bc569020e281c5908733bf4b7eeddf15.tar.gz CMake-f0a89149bc569020e281c5908733bf4b7eeddf15.tar.bz2 |
RunCMake: Automatically support platform out override files
-rw-r--r-- | Tests/RunCMake/README.rst | 6 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_file/PrefixInPATH-stdout.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/find_file/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/PrefixInPATH-stdout-cygwin.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/PrefixInPATH-stdout-windows.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/PrefixInPATH-stdout.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/find_path/PrefixInPATH-stdout.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/find_path/RunCMakeTest.cmake | 4 |
14 files changed, 52 insertions, 18 deletions
diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index d8b43fe..ebe40cf 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -55,6 +55,12 @@ but do not actually build anything. To add a test: ``<SubTest>-check.cmake`` Custom result check. + Note that when a specific platform expects differing stdout or stderr that + can be done by adding a platform specific output file. These follow the + naming convention of: + ``<SubTest>-stdout-<platform_lower_case>.txt`` + ``<SubTest>-stderr-<platform_lower_case>.txt`` + Note that trailing newlines will be stripped from actual and expected test output before matching against the stdout and stderr expressions. The code in ``<SubTest>-check.cmake`` may use variables diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ad3f8f6..e730d6e 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -21,10 +21,20 @@ function(run_cmake test) else() set(expect_result 0) endif() + + string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform_name) + if(platform_name MATCHES cygwin) + #remove all additional bits from cygwin name + set(platform_name cygwin) + endif() + foreach(o out err) if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o}) string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + elseif(EXISTS ${top_src}/${test}-std${o}-${platform_name}.txt) + file(READ ${top_src}/${test}-std${o}-${platform_name}.txt expect_std${o}) + string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") elseif(EXISTS ${top_src}/${test}-std${o}.txt) file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt new file mode 100644 index 0000000..d73bc1d --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt new file mode 100644 index 0000000..d73bc1d --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt index d73bc1d..947a900 100644 --- a/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt @@ -1,4 +1,4 @@ -- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' diff --git a/Tests/RunCMake/find_file/RunCMakeTest.cmake b/Tests/RunCMake/find_file/RunCMakeTest.cmake index 5ce96e0..014f397 100644 --- a/Tests/RunCMake/find_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_file/RunCMakeTest.cmake @@ -1,5 +1,3 @@ include(RunCMake) -if(WIN32 OR CYGWIN) - run_cmake(PrefixInPATH) -endif() +run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout-cygwin.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout-cygwin.txt new file mode 100644 index 0000000..1ab884c --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout-cygwin.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout-windows.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout-windows.txt new file mode 100644 index 0000000..1ab884c --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout-windows.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt index 1ab884c..c6ff513 100644 --- a/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt @@ -1,4 +1,4 @@ -- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' --- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' --- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' --- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index e7e8db3..ecfa0fe 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -4,6 +4,4 @@ run_cmake(Created) if(CMAKE_HOST_UNIX) run_cmake(LibArchLink) endif() -if(WIN32 OR CYGWIN) - run_cmake(PrefixInPATH) -endif() +run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt new file mode 100644 index 0000000..bb2ceb7 --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt new file mode 100644 index 0000000..bb2ceb7 --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt index bb2ceb7..947a900 100644 --- a/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt @@ -1,4 +1,4 @@ -- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' --- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake index bf0fa89..6d22124 100644 --- a/Tests/RunCMake/find_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -1,8 +1,6 @@ include(RunCMake) -if(WIN32 OR CYGWIN) - run_cmake(PrefixInPATH) -endif() +run_cmake(PrefixInPATH) if(APPLE) run_cmake(FrameworksWithSubdirs) |