Replace include_directories() with target_include_directories()
to prevent inheritance of include directories that possibly lead to a clash.
A clash occurs when a folder is included, e.g. examples, that wants to use the single-include directory instead of the normal include directory as used by the SelfTest in the next higher level.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41d2f44..de04685 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -281,12 +281,12 @@
SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
# configure the executable
-include_directories(${HEADER_DIR})
# Projects consuming Catch via ExternalProject_Add might want to use install step
# without building all of our selftests.
if (NOT NO_SELFTEST)
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
+ target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
# Add desired warnings
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )