summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2016-08-19 19:50:48 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-31 13:16:44 (GMT)
commitdf32e564aed43470e304cf21d8c9ac1d5a01d055 (patch)
treeb936ba3992df59535e3e80bba12b20bac3e78d52 /Tests/RunCMake
parentff88df48e8a693f213a44aee3ad2474f500857b5 (diff)
downloadCMake-df32e564aed43470e304cf21d8c9ac1d5a01d055.zip
CMake-df32e564aed43470e304cf21d8c9ac1d5a01d055.tar.gz
CMake-df32e564aed43470e304cf21d8c9ac1d5a01d055.tar.bz2
Xcode: Add targets marked as EXCLUDE_FROM_ALL to project (#16101)
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake6
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/bar.cpp1
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.cpp6
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.h1
-rw-r--r--Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/add_subdirectory/main.cpp6
7 files changed, 36 insertions, 0 deletions
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake b/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake
new file mode 100644
index 0000000..f686005
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake
@@ -0,0 +1,6 @@
+enable_language(CXX)
+
+add_subdirectory(ExcludeFromAll EXCLUDE_FROM_ALL)
+
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE foo)
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt
new file mode 100644
index 0000000..b1df6b0
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_library(bar STATIC bar.cpp)
+
+add_library(foo STATIC foo.cpp)
+target_include_directories(foo PUBLIC .)
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/bar.cpp b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/bar.cpp
new file mode 100644
index 0000000..7a828bd
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/bar.cpp
@@ -0,0 +1 @@
+#error This should be excluded from all target
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.cpp b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.cpp
new file mode 100644
index 0000000..c9ad322
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int foo()
+{
+ return 42;
+}
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.h b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.h
new file mode 100644
index 0000000..5d5f8f0
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/foo.h
@@ -0,0 +1 @@
+int foo();
diff --git a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
index 9d514e1..88b9283 100644
--- a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
@@ -3,3 +3,15 @@ include(RunCMake)
run_cmake(DoesNotExist)
run_cmake(Missing)
run_cmake(Function)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+run_cmake(ExcludeFromAll)
+run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build .)
+
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/add_subdirectory/main.cpp b/Tests/RunCMake/add_subdirectory/main.cpp
new file mode 100644
index 0000000..1dc3906
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(int, char**)
+{
+ return foo();
+}