mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
RunCMake: Automatically support platform out override files
This commit is contained in:
committed by
Brad King
parent
6425a5f3a0
commit
f0a89149bc
@@ -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
|
||||
|
||||
@@ -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}}")
|
||||
|
||||
4
Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt
Normal file
4
Tests/RunCMake/find_file/PrefixInPATH-stdout-cygwin.txt
Normal file
@@ -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'
|
||||
4
Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt
Normal file
4
Tests/RunCMake/find_file/PrefixInPATH-stdout-windows.txt
Normal file
@@ -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'
|
||||
@@ -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'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
if(WIN32 OR CYGWIN)
|
||||
run_cmake(PrefixInPATH)
|
||||
endif()
|
||||
run_cmake(PrefixInPATH)
|
||||
|
||||
@@ -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'
|
||||
@@ -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'
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
4
Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt
Normal file
4
Tests/RunCMake/find_path/PrefixInPATH-stdout-cygwin.txt
Normal file
@@ -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'
|
||||
4
Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt
Normal file
4
Tests/RunCMake/find_path/PrefixInPATH-stdout-windows.txt
Normal file
@@ -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'
|
||||
@@ -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'
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
include(RunCMake)
|
||||
|
||||
if(WIN32 OR CYGWIN)
|
||||
run_cmake(PrefixInPATH)
|
||||
endif()
|
||||
run_cmake(PrefixInPATH)
|
||||
|
||||
if(APPLE)
|
||||
run_cmake(FrameworksWithSubdirs)
|
||||
|
||||
Reference in New Issue
Block a user