summaryrefslogtreecommitdiffstats
path: root/test/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-04 14:59:29 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-04 14:59:29 (GMT)
commit8d8aacd65af229da0cadf81911ffa3ef77db7b57 (patch)
tree7a85fbe387dae1fb9667176fe6ce350df28e09f0 /test/CMakeLists.txt
parent1074cb11ebdc29bff2fc7eb633252348e0758106 (diff)
downloadCastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.zip
CastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.tar.gz
CastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.tar.bz2
Detect: Use Clang builtin include dir even with --castxml-cc-<id>
We need implementation-provided headers to come from Clang to match what is really built in to the parser. When not using --castxml-cc-<id>, the Clang driver adds its builtin include directory in methods like Linux::AddClangSystemIncludeArgs MSVCToolChain::AddClangSystemIncludeArgs CrossWindowsToolChain::AddClangSystemIncludeArgs (see lib/Driver/*ToolChain*.cpp). When using --castxml-cc-<id>, we must add the Clang builtin include dir in the appropriate place. GNU-like compilers should have a builtin include directory too, providing files like <emmintrin.h>. The Clang driver does not add this directory from GCC toolchains and instead adds its own builtin include directory. In this case, replace the detected compiler builtin include directory with ours. MSVC-like compilers have no separate builtin include directory. The Clang driver simply places its own builtin include direcory before the system include directory read from the INCLUDE environment variable. In this case, do the same.
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r--test/CMakeLists.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index db8bc74..1725bbb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -123,6 +123,8 @@ castxml_test_cmd(rsp-o-missing @${input}/o-missing.rsp)
# Test --castxml-cc-gnu detection.
add_executable(cc-gnu cc-gnu.c)
+set_property(SOURCE cc-gnu.c APPEND PROPERTY COMPILE_DEFINITIONS
+ "TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
castxml_test_cmd(cc-gnu-c-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} -E -dM)
castxml_test_cmd(cc-gnu-c-cmd --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} "-###")
castxml_test_cmd(cc-gnu-cxx-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} -E -dM)