[cmake-developers] target_include_directories and empty lists

Stephen Kelly steveire at gmail.com
Wed Jul 31 10:01:44 EDT 2013


Brad King wrote:
> What about the tll() version?

 target_link_libraries(foo PRIVATE )

seems to not be an error with master already.

> 
>> Changing that behavior is something I'd recommend deferring to after
>> 2.8.12 if you want to change it. I don't feel extremely strongly about
>> keeping it strict.
> 
> How intrusive is the change?

It might be as simple as 

diff --git a/Source/cmTargetPropCommandBase.cxx 
b/Source/cmTargetPropCommandBase.cxx
index 287ce46..37aa604 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -19,7 +19,7 @@ bool cmTargetPropCommandBase
 ::HandleArguments(std::vector<std::string> const& args, const char *prop,
                  ArgumentFlags flags)
 {
-  if(args.size() < 3)
+  if(args.size() < 2)
     {
     this->SetError("called with incorrect number of arguments");
     return false;
@@ -53,7 +53,7 @@ bool cmTargetPropCommandBase
 
   if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM")
     {
-    if (args.size() < 4)
+    if (args.size() < 3)
       {
       this->SetError("called with incorrect number of arguments");
       return false;
@@ -65,7 +65,7 @@ bool cmTargetPropCommandBase
   bool prepend = false;
   if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE")
     {
-    if (args.size() < 4)
+    if (args.size() < 3)
       {
       this->SetError("called with incorrect number of arguments");
       return false;



... but I haven't tried most of the arg combinations.


> I don't want to make people wait for
> 2.8.13 just to avoid creating conditions like
> 
>  if(mylist)
>    target_include_directories(... PUBLIC ${mylist})
>  endif()
> 

Ok, I'll add a test for the above patch and submit that.

Thanks,

Steve.






More information about the cmake-developers mailing list