summaryrefslogtreecommitdiff
path: root/Tests/ExportImport/Import
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ExportImport/Import')
-rw-r--r--Tests/ExportImport/Import/A/deps_iface.c9
-rw-r--r--Tests/ExportImport/Import/Interface/CMakeLists.txt11
-rw-r--r--Tests/ExportImport/Import/Interface/pch_iface_test.cpp16
3 files changed, 31 insertions, 5 deletions
diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c
index e2d973c2f..afb1af01f 100644
--- a/Tests/ExportImport/Import/A/deps_iface.c
+++ b/Tests/ExportImport/Import/A/deps_iface.c
@@ -1,9 +1,4 @@
-#include "testLibIncludeRequired1.h"
-#include "testLibIncludeRequired2.h"
-#include "testLibIncludeRequired6.h"
-#include "testLibIncludeRequired7.h"
-
#include "installIncludesTest.h"
#include "installIncludesTest2.h"
#include "installIncludesTest3.h"
@@ -12,6 +7,10 @@
#include "installIncludesTest6.h"
#include "installIncludesTest7.h"
#include "installIncludesTest8.h"
+#include "testLibIncludeRequired1.h"
+#include "testLibIncludeRequired2.h"
+#include "testLibIncludeRequired6.h"
+#include "testLibIncludeRequired7.h"
#ifndef testLibRequired_IFACE_DEFINE
# error Expected testLibRequired_IFACE_DEFINE
diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt
index a07a5b3c4..ef666b1a7 100644
--- a/Tests/ExportImport/Import/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt
@@ -98,6 +98,17 @@ set_property(TARGET exp::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES de
add_executable(interfacetest_exp interfacetest.cpp)
target_link_libraries(interfacetest_exp exp::sharediface)
+if(NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]" OR CMAKE_GENERATOR STREQUAL "Xcode")
+ add_executable(pch_iface_test_bld pch_iface_test.cpp)
+ target_link_libraries(pch_iface_test_bld bld::pch_iface)
+ add_executable(pch_iface_test_exp pch_iface_test.cpp)
+ target_link_libraries(pch_iface_test_exp exp::pch_iface)
+ if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH)
+ target_compile_definitions(pch_iface_test_bld PRIVATE EXPECT_PCH)
+ target_compile_definitions(pch_iface_test_exp PRIVATE EXPECT_PCH)
+ endif()
+endif()
+
do_try_compile(exp)
foreach(ns exp bld)
diff --git a/Tests/ExportImport/Import/Interface/pch_iface_test.cpp b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp
new file mode 100644
index 000000000..a18bbde23
--- /dev/null
+++ b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp
@@ -0,0 +1,16 @@
+#ifdef EXPECT_PCH
+// Verify that pch/pch.h was included via '-include ...' or equivalent.
+# ifndef PCH_PCH_H_INCLUDED
+# error "Expected PCH_PCH_H_INCLUDED."
+# endif
+#elif defined(__PGIC__) || defined(__ibmxl__) || defined(_CRAYC)
+// No PCH expected but these compilers define macros below.
+#elif defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER) || \
+ defined(_MSC_VER)
+# error "Expected EXPECT_PCH for this compiler."
+#endif
+
+int main()
+{
+ return 0;
+}