From eef6df5c7d97680f9c20729555c061cf3e2b2482 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 22 Aug 2013 23:52:00 +0200 Subject: Fix OLD behavior of CMP0021. Exclude Ninja and Xcode from the CMP0021 test They do not behave the same as the makefile generator with relative paths. Don't overwrite the header file for in-source builds. --- Source/cmTarget.cxx | 5 ++++- Tests/IncludeDirectories/CMP0021/CMakeLists.txt | 14 ++++++++++++++ .../IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h | 2 ++ Tests/IncludeDirectories/CMP0021/main.cpp | 11 +++++++++++ Tests/IncludeDirectories/CMakeLists.txt | 4 ++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Tests/IncludeDirectories/CMP0021/CMakeLists.txt create mode 100644 Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h create mode 100644 Tests/IncludeDirectories/CMP0021/main.cpp diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 13cd006..ddb4e85 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3303,7 +3303,10 @@ static void processIncludeDirectories(cmTarget *tgt, if (!noMessage) { tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); - return; + if (messageType == cmake::FATAL_ERROR) + { + return; + } } } diff --git a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt b/Tests/IncludeDirectories/CMP0021/CMakeLists.txt new file mode 100644 index 0000000..0b9aee8 --- /dev/null +++ b/Tests/IncludeDirectories/CMP0021/CMakeLists.txt @@ -0,0 +1,14 @@ + +cmake_policy(SET CMP0021 OLD) +add_executable(cmp0021exe main.cpp) + +if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes") + execute_process(COMMAND ${CMAKE_COMMAND} -E + copy_directory + "${CMAKE_CURRENT_SOURCE_DIR}/includes" + "${CMAKE_CURRENT_BINARY_DIR}/includes" + ) +endif() +set_property(TARGET cmp0021exe PROPERTY + INCLUDE_DIRECTORIES includes/cmp0021) diff --git a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h b/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h new file mode 100644 index 0000000..3d49b31 --- /dev/null +++ b/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h @@ -0,0 +1,2 @@ + +#define CMP0021_DEFINE diff --git a/Tests/IncludeDirectories/CMP0021/main.cpp b/Tests/IncludeDirectories/CMP0021/main.cpp new file mode 100644 index 0000000..f886c46 --- /dev/null +++ b/Tests/IncludeDirectories/CMP0021/main.cpp @@ -0,0 +1,11 @@ + +#include "cmp0021.h" + +#ifndef CMP0021_DEFINE +#error Expected CMP0021_DEFINE +#endif + +int main(int, char **) +{ + return 0; +} diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 596a280..35ad8dc 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -86,3 +86,7 @@ get_target_property(incs empty_entry_test INCLUDE_DIRECTORIES) if (NOT incs STREQUAL ";/one/two") message(SEND_ERROR "Empty include_directories entry was not ignored.") endif() + +if(NOT CMAKE_GENERATOR STREQUAL Xcode AND NOT CMAKE_GENERATOR STREQUAL Ninja) + add_subdirectory(CMP0021) +endif() -- cgit v0.12