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.
This commit is contained in:
parent
374af6529a
commit
eef6df5c7d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
14
Tests/IncludeDirectories/CMP0021/CMakeLists.txt
Normal file
14
Tests/IncludeDirectories/CMP0021/CMakeLists.txt
Normal file
@ -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)
|
@ -0,0 +1,2 @@
|
||||
|
||||
#define CMP0021_DEFINE
|
11
Tests/IncludeDirectories/CMP0021/main.cpp
Normal file
11
Tests/IncludeDirectories/CMP0021/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#include "cmp0021.h"
|
||||
|
||||
#ifndef CMP0021_DEFINE
|
||||
#error Expected CMP0021_DEFINE
|
||||
#endif
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user