diff options
author | Brad King <brad.king@kitware.com> | 2015-02-24 21:12:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-25 13:41:56 (GMT) |
commit | 5c8a1e735f8ff5f4b02e220033f72177a69467e4 (patch) | |
tree | 1bc361846c456c4f6d6d1d5e3fa4b74ea8cfa413 /test | |
parent | 5e8d715e0eb494ef55c929243d26b93bf56ad97e (diff) | |
download | CastXML-5c8a1e735f8ff5f4b02e220033f72177a69467e4.zip CastXML-5c8a1e735f8ff5f4b02e220033f72177a69467e4.tar.gz CastXML-5c8a1e735f8ff5f4b02e220033f72177a69467e4.tar.bz2 |
test: Add infrastructure to run tests against real GNU compilers
Find gcc and g++ tools on the local system to use for running
tests for simulating real compilers with --castxml-cc-gnu.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1725bbb..1430dca 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -230,3 +230,39 @@ castxml_test_gccxml_c(invalid) castxml_test_gccxml_broken(Class-template-constructor-template) castxml_test_gccxml_broken(ReferenceType-to-Class-template) + +#----------------------------------------------------------------------------- +# Find a real GNU compiler to test with --castxml-cc-gnu. + +set(_gnu_C gcc) +set(_gnu_CXX g++) + +foreach(lang C CXX) + find_program(TEST_GNU_${lang} NAMES ${_gnu_${lang}} DOC "Path to GNU ${_gnu_${lang}} compiler for testing") + # Exclude the Apple LLVM tool that is not really a GNU compiler. + if(TEST_GNU_${lang}) + execute_process( + COMMAND ${TEST_GNU_${lang}} --version + OUTPUT_VARIABLE version + ERROR_VARIABLE version + RESULT_VARIABLE failed + ) + if(failed OR version MATCHES "Apple LLVM") + set(TEST_GNU_${lang} TEST_GNU_${lang}-NOTFOUND) + endif() + endif() + if(TEST_GNU_${lang}) + set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_C}) + message(STATUS "Found GNU ${lang} compiler '${TEST_GNU_C}' to drive tests") + endif() +endforeach() + +if(TEST_GNU_C) + set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_C}) + unset(castxml_test_gccxml_extra_arguments) +endif() + +if(TEST_GNU_CXX) + set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_CXX}) + unset(castxml_test_gccxml_extra_arguments) +endif() |