cmTarget: Don't update IMPORTED target compilation properties
The include_directories() and add_compile_options() commands should not append to the corresponding target property for IMPORTED targets. This is already the case for add_definitions().
This commit is contained in:
parent
03d842a982
commit
272a20f8e5
|
@ -4045,8 +4045,8 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
|
|||
// Create the target.
|
||||
cmsys::auto_ptr<cmTarget> target(new cmTarget);
|
||||
target->SetType(type, name);
|
||||
target->SetMakefile(this);
|
||||
target->MarkAsImported();
|
||||
target->SetMakefile(this);
|
||||
|
||||
// Add to the set of available imported targets.
|
||||
this->ImportedTargets[name] = target.get();
|
||||
|
|
|
@ -330,6 +330,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
// Save the backtrace of target construction.
|
||||
this->Makefile->GetBacktrace(this->Internal->Backtrace);
|
||||
|
||||
if (!this->IsImported())
|
||||
{
|
||||
// Initialize the INCLUDE_DIRECTORIES property based on the current value
|
||||
// of the same directory property:
|
||||
const std::vector<cmValueWithOrigin> parentIncludes =
|
||||
|
@ -340,7 +342,6 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
{
|
||||
this->InsertInclude(*it);
|
||||
}
|
||||
|
||||
const std::set<cmStdString> parentSystemIncludes =
|
||||
this->Makefile->GetSystemIncludeDirectories();
|
||||
|
||||
|
@ -359,6 +360,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
{
|
||||
this->InsertCompileOption(*it);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->GetType() != INTERFACE_LIBRARY)
|
||||
{
|
||||
|
|
|
@ -12,3 +12,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
"DO_GNU_TESTS"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_compile_options(-rtti)
|
||||
add_library(imp UNKNOWN IMPORTED)
|
||||
get_target_property(_res imp COMPILE_OPTIONS)
|
||||
if (_res)
|
||||
message(SEND_ERROR "add_compile_options populated the COMPILE_OPTIONS target property")
|
||||
endif()
|
||||
|
|
|
@ -25,3 +25,10 @@ target_compile_definitions(consumer
|
|||
target_compile_definitions(consumer
|
||||
PRIVATE
|
||||
)
|
||||
|
||||
add_definitions(-DSOME_DEF)
|
||||
add_library(imp UNKNOWN IMPORTED)
|
||||
get_target_property(_res imp COMPILE_DEFINITIONS)
|
||||
if (_res)
|
||||
message(SEND_ERROR "add_definitions populated the COMPILE_DEFINITIONS target property")
|
||||
endif()
|
||||
|
|
|
@ -62,3 +62,10 @@ target_include_directories(consumer
|
|||
target_include_directories(consumer
|
||||
SYSTEM PRIVATE
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_library(imp UNKNOWN IMPORTED)
|
||||
get_target_property(_res imp INCLUDE_DIRECTORIES)
|
||||
if (_res)
|
||||
message(SEND_ERROR "include_directories populated the INCLUDE_DIRECTORIES target property")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue