mirror of
https://github.com/reactos/CMake.git
synced 2024-12-01 07:20:22 +00:00
Merge topic 'fix-buildsystem-target-properties'
b9856862
Tests: Cover set_property for buildsystem target properties407ff47e
cmTarget: Fix memory leak when SOURCES property is clearedcf74fc24
cmTarget: Fix buildsystem property empty value set and append operations
This commit is contained in:
commit
70ea1d91fa
@ -1601,33 +1601,45 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
||||
{
|
||||
this->Internal->IncludeDirectoriesEntries.clear();
|
||||
this->Internal->IncludeDirectoriesBacktraces.clear();
|
||||
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
this->Internal->CompileOptionsEntries.clear();
|
||||
this->Internal->CompileOptionsBacktraces.clear();
|
||||
this->Internal->CompileOptionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileOptionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_FEATURES")
|
||||
{
|
||||
this->Internal->CompileFeaturesEntries.clear();
|
||||
this->Internal->CompileFeaturesBacktraces.clear();
|
||||
this->Internal->CompileFeaturesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileFeaturesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
this->Internal->CompileDefinitionsEntries.clear();
|
||||
this->Internal->CompileDefinitionsBacktraces.clear();
|
||||
this->Internal->CompileDefinitionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileDefinitionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "EXPORT_NAME" && this->IsImported())
|
||||
{
|
||||
@ -1659,6 +1671,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmDeleteAll(this->Internal->SourceEntries);
|
||||
this->Internal->SourceEntries.clear();
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
|
||||
this->Internal->SourceEntries.push_back(
|
||||
@ -1693,27 +1706,39 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
||||
}
|
||||
else if(prop == "INCLUDE_DIRECTORIES")
|
||||
{
|
||||
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
this->Internal->CompileOptionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileOptionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_FEATURES")
|
||||
{
|
||||
this->Internal->CompileFeaturesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileFeaturesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
this->Internal->CompileDefinitionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
|
||||
if (value)
|
||||
{
|
||||
this->Internal->CompileDefinitionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else if(prop == "EXPORT_NAME" && this->IsImported())
|
||||
{
|
||||
|
@ -0,0 +1 @@
|
||||
-- Target COMPILE_DEFINITIONS is 'a;;b;c;;d;;e'
|
2
Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
Normal file
2
Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(COMPILE_DEFINITIONS)
|
1
Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt
Normal file
1
Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt
Normal file
@ -0,0 +1 @@
|
||||
-- Target COMPILE_FEATURES is 'a;;b;c;;d;;e'
|
2
Tests/RunCMake/set_property/COMPILE_FEATURES.cmake
Normal file
2
Tests/RunCMake/set_property/COMPILE_FEATURES.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(COMPILE_FEATURES)
|
1
Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
Normal file
1
Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
Normal file
@ -0,0 +1 @@
|
||||
-- Target COMPILE_OPTIONS is 'a;;b;c;;d;;e'
|
2
Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
Normal file
2
Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(COMPILE_OPTIONS)
|
14
Tests/RunCMake/set_property/Common.cmake
Normal file
14
Tests/RunCMake/set_property/Common.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
macro(test_target_property PROP)
|
||||
add_custom_target(CustomTarget)
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP} x)
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP} a)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "")
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} b c)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "d;;e")
|
||||
get_property(val TARGET CustomTarget PROPERTY ${PROP})
|
||||
message(STATUS "Target ${PROP} is '${val}'")
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP})
|
||||
endmacro()
|
@ -0,0 +1 @@
|
||||
-- Target INCLUDE_DIRECTORIES is 'a;;b;c;;d;;e'
|
2
Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
Normal file
2
Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(INCLUDE_DIRECTORIES)
|
1
Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt
Normal file
1
Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt
Normal file
@ -0,0 +1 @@
|
||||
-- Target LINK_LIBRARIES is 'a;;b;c;;d;;e'
|
@ -1,7 +1,2 @@
|
||||
add_custom_target(CustomTarget)
|
||||
set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES)
|
||||
get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES)
|
||||
if (NOT "${val}" STREQUAL "")
|
||||
message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''")
|
||||
endif()
|
||||
include(Common.cmake)
|
||||
test_target_property(LINK_LIBRARIES)
|
||||
|
@ -1,3 +1,9 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(COMPILE_DEFINITIONS)
|
||||
run_cmake(COMPILE_FEATURES)
|
||||
run_cmake(COMPILE_OPTIONS)
|
||||
run_cmake(INCLUDE_DIRECTORIES)
|
||||
run_cmake(LINK_LIBRARIES)
|
||||
run_cmake(SOURCES)
|
||||
run_cmake(USER_PROP)
|
||||
|
1
Tests/RunCMake/set_property/SOURCES-stdout.txt
Normal file
1
Tests/RunCMake/set_property/SOURCES-stdout.txt
Normal file
@ -0,0 +1 @@
|
||||
-- Target SOURCES is 'a;b;c;d;e'
|
2
Tests/RunCMake/set_property/SOURCES.cmake
Normal file
2
Tests/RunCMake/set_property/SOURCES.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(SOURCES)
|
1
Tests/RunCMake/set_property/USER_PROP-stdout.txt
Normal file
1
Tests/RunCMake/set_property/USER_PROP-stdout.txt
Normal file
@ -0,0 +1 @@
|
||||
-- Target USER_PROP is 'a;b;c;d;;e'
|
2
Tests/RunCMake/set_property/USER_PROP.cmake
Normal file
2
Tests/RunCMake/set_property/USER_PROP.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Common.cmake)
|
||||
test_target_property(USER_PROP)
|
Loading…
Reference in New Issue
Block a user