summaryrefslogtreecommitdiffstats
path: root/Tests/Complex
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Complex')
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt17
-rw-r--r--Tests/Complex/Library/CMakeLists.txt4
2 files changed, 21 insertions, 0 deletions
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 1c406b9..9f64cbb 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -16,6 +16,23 @@ IF(COMPLEX_TEST_CMAKELIB)
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar)
ENDIF(COMPLEX_TEST_CMAKELIB)
+# Create an imported target for if(TARGET) test below.
+ADD_LIBRARY(ExeImportedTarget UNKNOWN IMPORTED)
+
+# Test if(TARGET) command.
+IF(NOT TARGET CMakeTestLibrary)
+ MESSAGE(FATAL_ERROR "IF(NOT TARGET CMakeTestLibrary) returned true!")
+ENDIF(NOT TARGET CMakeTestLibrary)
+IF(NOT TARGET ExeImportedTarget)
+ MESSAGE(FATAL_ERROR "IF(NOT TARGET ExeImportedTarget) returned true!")
+ENDIF(NOT TARGET ExeImportedTarget)
+IF(TARGET LibImportedTarget)
+ MESSAGE(FATAL_ERROR "IF(TARGET LibImportedTarget) returned true!")
+ENDIF(TARGET LibImportedTarget)
+IF(TARGET NotATarget)
+ MESSAGE(FATAL_ERROR "IF(TARGET NotATarget) returned true!")
+ENDIF(TARGET NotATarget)
+
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 0fae1ec..4f2e5a4 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -114,6 +114,10 @@ INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
# Test creating a library that is not built by default.
ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx)
+# Create an imported target for if(TARGET) test in Executable dir.
+# That test should not see this target.
+ADD_LIBRARY(LibImportedTarget UNKNOWN IMPORTED)
+
# Test generation of preprocessed sources.
IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)