summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-01 22:20:04 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-10 14:46:57 (GMT)
commit8a37ebec784cefe4f04cb8897c23a014c3930052 (patch)
tree6a1fff33c9447c3fbb87f2496baf57fa208f4dec /Tests
parentc2cde7f1047b2f11e7d4a466000a20d8c42394be (diff)
downloadCMake-8a37ebec784cefe4f04cb8897c23a014c3930052.zip
CMake-8a37ebec784cefe4f04cb8897c23a014c3930052.tar.gz
CMake-8a37ebec784cefe4f04cb8897c23a014c3930052.tar.bz2
Add the target_include_directories command.
This is a convenience API to populate the corresponding properties.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_include_directories/CMakeLists.txt50
-rw-r--r--Tests/CMakeCommands/target_include_directories/consumer.cpp27
-rw-r--r--Tests/CMakeCommands/target_include_directories/main.cpp22
-rw-r--r--Tests/CMakeLists.txt1
4 files changed, 100 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
new file mode 100644
index 0000000..a0f2ee0
--- /dev/null
+++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(target_include_directories)
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/privateinclude")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/privateinclude/privateinclude.h" "#define PRIVATEINCLUDE_DEFINE\n")
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/publicinclude")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/publicinclude/publicinclude.h" "#define PUBLICINCLUDE_DEFINE\n")
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude/interfaceinclude.h" "#define INTERFACEINCLUDE_DEFINE\n")
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/importedinterfaceinclude")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/importedinterfaceinclude/importedinterfaceinclude.h" "#define IMPORTEDINTERFACEINCLUDE_DEFINE\n")
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/poison")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/poison/common.h" "#error Should not be included\n")
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cure")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cure/common.h" "#define CURE_DEFINE\n")
+
+add_executable(target_include_directories
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
+)
+target_include_directories(target_include_directories
+ PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/privateinclude"
+ PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/publicinclude"
+ INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude"
+)
+
+target_include_directories(target_include_directories
+ PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/poison"
+)
+target_include_directories(target_include_directories
+ BEFORE PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/cure"
+)
+
+add_library(importedlib UNKNOWN IMPORTED)
+target_include_directories(importedlib
+ INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/importedinterfaceinclude"
+)
+
+add_executable(consumer
+ "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
+)
+
+target_include_directories(consumer
+ PRIVATE target_include_directories importedlib
+)
diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp
new file mode 100644
index 0000000..6fd61d5
--- /dev/null
+++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp
@@ -0,0 +1,27 @@
+
+#include "common.h"
+#include "publicinclude.h"
+#include "interfaceinclude.h"
+#include "importedinterfaceinclude.h"
+
+#ifdef PRIVATEINCLUDE_DEFINE
+#error Unexpected PRIVATEINCLUDE_DEFINE
+#endif
+
+#ifndef PUBLICINCLUDE_DEFINE
+#error Expected PUBLICINCLUDE_DEFINE
+#endif
+
+#ifndef INTERFACEINCLUDE_DEFINE
+#error Expected INTERFACEINCLUDE_DEFINE
+#endif
+
+#ifndef IMPORTEDINTERFACEINCLUDE_DEFINE
+#error Expected IMPORTEDINTERFACEINCLUDE_DEFINE
+#endif
+
+#ifndef CURE_DEFINE
+#error Expected CURE_DEFINE
+#endif
+
+int main() { return 0; }
diff --git a/Tests/CMakeCommands/target_include_directories/main.cpp b/Tests/CMakeCommands/target_include_directories/main.cpp
new file mode 100644
index 0000000..8434b97
--- /dev/null
+++ b/Tests/CMakeCommands/target_include_directories/main.cpp
@@ -0,0 +1,22 @@
+
+#include "common.h"
+#include "privateinclude.h"
+#include "publicinclude.h"
+
+#ifndef PRIVATEINCLUDE_DEFINE
+#error Expected PRIVATEINCLUDE_DEFINE
+#endif
+
+#ifndef PUBLICINCLUDE_DEFINE
+#error Expected PUBLICINCLUDE_DEFINE
+#endif
+
+#ifdef INTERFACEINCLUDE_DEFINE
+#error Unexpected INTERFACEINCLUDE_DEFINE
+#endif
+
+#ifndef CURE_DEFINE
+#error Expected CURE_DEFINE
+#endif
+
+int main() { return 0; }
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ade6a01..2dced5f 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1930,6 +1930,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
+ ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"