[cmake-developers] [PATCH] Fix crash in cmExportInstallFileGenerator::FindNamespaces()

2016-01-20 Thread Andrey Pokrovskiy
>From 0852339e3ab545af709246c8e767e996cb629707 Mon Sep 17 00:00:00 2001
From: wonder-mice 
Date: Wed, 20 Jan 2016 18:29:58 -0800
Subject: [PATCH] Fix crash in cmExportInstallFileGenerator::FindNamespaces()

Found it when was building poco library:
https://github.com/pocoproject/poco.git

Steps to reproduce:
1. Clone poco
2. mkdir poco.git/build.make
3. cd poco.git/build.make
4. cmake ..
5. Crash

As I understand this place was missed during refactoring performed in
this commit:

commit 381e7afd363d64c72b83e69fd6c6cad5fc3eefb4
Author: Stephen Kelly 
Date:   Sat Oct 17 13:31:33 2015 +0200

cmExportSet: Store a cmGeneratorTarget.

Set the member at compute time from the stored name.
---
 Source/cmExportInstallFileGenerator.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/cmExportInstallFileGenerator.cxx
b/Source/cmExportInstallFileGenerator.cxx
index b695904..71418e8 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -496,7 +496,7 @@ cmExportInstallFileGenerator
 bool containsTarget = false;
 for(unsigned int i=0; isize(); i++)
   {
-  if (name == (*targets)[i]->Target->GetName())
+  if (name == (*targets)[i]->TargetName)
 {
 containsTarget = true;
 break;
-- 
2.5.4 (Apple Git-61)


0001-Fix-crash-in-cmExportInstallFileGenerator-FindNamesp.patch
Description: Binary data
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] [PATCH] Fix args handling in cmake -E time

2016-01-20 Thread Andrey Pokrovskiy
Thanks, Brad.

Your patch is much better. I also was looking for overload that
receives a vector, but for some reason didn't find it...

On Wed, Jan 20, 2016 at 6:01 AM, Brad King <brad.k...@kitware.com> wrote:
> On 01/19/2016 09:20 PM, Andrey Pokrovskiy wrote:
>> Previous implementation had two issues:
>> * Quotes in arguments where not escaped
>> * No special treatment for arguments with spaces
>
> Thanks for pointing this out.  Please try this alternative fix:
>
>  cmake: Fix `-E time` argument passing to child
>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1787269e
>
> Technically this is an incompatibility but I think most uses of
> this command would be interactive anyway.
>
> -Brad
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [PATCH] Fix args handling in cmake -E time

2016-01-19 Thread Andrey Pokrovskiy
>From 7b01d1aed22b16fd81c3ae47dd51311e9a15187a Mon Sep 17 00:00:00 2001
From: wonder-mice 
Date: Tue, 19 Jan 2016 18:13:10 -0800
Subject: [PATCH] Fix args handling in cmake -E time

Previous implementation had two issues:
* Quotes in arguments where not escaped
* No special treatment for arguments with spaces

Because of that, following command line:
  cmake -E time cmake "-GUnix Makefile"
was interpreted as
  cmake -E time cmake "-GUnix" "Makefile"
Proposed patch fixes that by escaping all quotes in arguments and
wrapping all arguments in quotes before concatenating them.
---
 Source/cmAlgorithms.h | 2 +-
 Source/cmcmd.cxx  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index ef607d2..5b76429 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -230,7 +230,7 @@ template
 std::string cmJoin(Range const& r, std::string delimiter)
 {
   return cmJoin(r, delimiter.c_str());
-};
+}

 template
 typename Range::const_iterator cmRemoveN(Range& r, size_t n)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index fb7b1f5..5643cb9 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -555,7 +555,7 @@ int
cmcmd::ExecuteCMakeCommand(std::vector& args)
 // Clock command
 else if (args[1] == "time" && args.size() > 2)
   {
-  std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
+  std::string command = cmWrap('"', cmMakeRange(args).advance(2),
'"', " ");

   clock_t clock_start, clock_finish;
   time_t time_start, time_finish;
-- 
2.5.4 (Apple Git-61)


0001-Fix-args-handling-in-cmake-E-time.patch
Description: Binary data
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

[cmake-developers] CMAKE_TOOLCHAIN_FILE and ExternalProject_Add

2015-04-26 Thread Andrey Pokrovskiy
Hi,

I'm using cmake and CMAKE_TOOLCHAIN_FILE to build the project and it's
dependencies. Some toolchain files have additional options (like API
version, target architecture, linker type, etc.) which you need to
pass to cmake command with -D in addition to the
-DCMAKE_TOOLCHAIN_FILE= itself.

So when you want to build some dependency with ExternalProject_Add()
it's not enough to pass the same CMAKE_TOOLCHAIN_FILE. You also need
to explicitly specify all other toolchain variables that you care
about. That means that each time you start to override another
toolchain variables or add a new toolchain, you need to carefully add
proper variable forwardings to each ExternalProject_Add() call. This
is not convenient and error prone.

What do you think about formalizing toolchains a bit further? For
example, it would be nice to have a way to get all variables (with
their values) that are relevant for the current toolchain. Consider:

ExternalProject_Add(websockets_ep
CMAKE_ARGS
-DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_TOOLCHAIN_ARGS:string=${CMAKE_TOOLCHAIN_ARGS})

Where ${CMAKE_TOOLCHAIN_ARGS} expands to VAR1=VAL1;VAR2=VAL2; (I
realize that will not work like that, but conceptually) which defines
toolchain configuration.

For example, well behaved toolchain file could be asked to mark each
configuration variable:

toolchain_option(ANDROID_NATIVE_API_LEVEL)

so CMake after processing of a toolchain file can have a list of all
relevant variables. Or maybe CMake can track all variables touched
by the toolchain file.

What do you think about that?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] CMAKE_TOOLCHAIN_FILE and ExternalProject_Add

2015-04-26 Thread Andrey Pokrovskiy
Because it will be an ad-hoc solution. Also each time I will start
using a new toolchain file (for another device/platform) I will need
to modify that wrapper script. And each time I will override some
toolchain variable I will need to look into that wrapper to verify
that this variable will be forwarded. Wouldn't it be nice if there was
a simple way to tell build this external project the same way as a
main one?

I'm not saying that the problem is unsolvable. I'm saying that right
now CMake is not very convenient for projects with a lot of external
dependencies. And specifying toolchain and it's options is a one
aspect of it (not the most important, though).


On Sun, Apr 26, 2015 at 5:36 PM, David Cole dlrd...@aol.com wrote:
 Why wouldn't you just write your own toolchain wrapper file which
 has all the variables you speak of, but also includes the real
 toolchain file, and then use the wrapper as your CMAKE_TOOLCHAIN_FILE
 value ... ?


 D



 On Sun, Apr 26, 2015 at 7:32 PM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 Hi,

 I'm using cmake and CMAKE_TOOLCHAIN_FILE to build the project and it's
 dependencies. Some toolchain files have additional options (like API
 version, target architecture, linker type, etc.) which you need to
 pass to cmake command with -D in addition to the
 -DCMAKE_TOOLCHAIN_FILE= itself.

 So when you want to build some dependency with ExternalProject_Add()
 it's not enough to pass the same CMAKE_TOOLCHAIN_FILE. You also need
 to explicitly specify all other toolchain variables that you care
 about. That means that each time you start to override another
 toolchain variables or add a new toolchain, you need to carefully add
 proper variable forwardings to each ExternalProject_Add() call. This
 is not convenient and error prone.

 What do you think about formalizing toolchains a bit further? For
 example, it would be nice to have a way to get all variables (with
 their values) that are relevant for the current toolchain. Consider:

 ExternalProject_Add(websockets_ep
 CMAKE_ARGS
 -DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_TOOLCHAIN_FILE}
 -DCMAKE_TOOLCHAIN_ARGS:string=${CMAKE_TOOLCHAIN_ARGS})

 Where ${CMAKE_TOOLCHAIN_ARGS} expands to VAR1=VAL1;VAR2=VAL2; (I
 realize that will not work like that, but conceptually) which defines
 toolchain configuration.

 For example, well behaved toolchain file could be asked to mark each
 configuration variable:

 toolchain_option(ANDROID_NATIVE_API_LEVEL)

 so CMake after processing of a toolchain file can have a list of all
 relevant variables. Or maybe CMake can track all variables touched
 by the toolchain file.

 What do you think about that?
 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more 
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [PATCH] Don't log over 9000 warnings when CMAKE_TOOLCHAIN_FILE is an empty string

2015-04-22 Thread Andrey Pokrovskiy
If CMAKE_TOOLCHAIN_FILE is an empty string cmake will generate a lot of
warnings:

CMake Warning (dev) at CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).

---
 Modules/CMakeDetermineSystem.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Modules/CMakeDetermineSystem.cmake
b/Modules/CMakeDetermineSystem.cmake
index fe292ea..fa14641 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -179,7 +179,7 @@ if(CMAKE_BINARY_DIR)
   # if a toolchain file is used, it needs to be included in the
configured file,
   # so settings done there are also available if they don't go in the
cache and in try_compile()
   set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED)
-  if(DEFINED CMAKE_TOOLCHAIN_FILE)
+  if(CMAKE_TOOLCHAIN_FILE)
 set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED
include(\${CMAKE_TOOLCHAIN_FILE}\))
   endif()

-- 
2.3.2 (Apple Git-55)


0001-Don-t-log-over-9000-warnings-when-CMAKE_TOOLCHAIN_FI.patch
Description: Binary data
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] [PATCH] ExternalProject_Add: Allow generator expressions in CMAKE_CACHE_ARGS

2015-04-21 Thread Andrey Pokrovskiy
Thanks for your comments, Brad.

I added a patch to convert the file(WRITE) calls in
_ep_write_log_script to file(GENERATE) calls. It works OK in my tests,
but honestly I'm not confident enough in those changes. Any test
recommendations?

I also added a patch to write init and log scripts to xxx-$CONFIG.
Also works, but I don't think my tests covered all cases.

Full patch set attached.

---
From cedeaaa4a285eab4b233e8a34be1e468e917e092 Mon Sep 17 00:00:00 2001
From: Pokrovskiy pok...@amazon.com
Date: Thu, 16 Apr 2015 21:42:19 -0700
Subject: [PATCH 1/3] ExternalProject_Add: Allow generator expressions in
 CMAKE_CACHE_ARGS

---
 Modules/ExternalProject.cmake | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0c73d41..1c7cf51 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1126,10 +1126,7 @@ function(_ep_write_initial_cache target_name
script_filename script_initial_cach
   # Replace location tags.
   _ep_replace_location_tags(${target_name} script_initial_cache)
   # Write out the initial cache file to the location specified.
-  if(NOT EXISTS ${script_filename}.in)
-file(WRITE ${script_filename}.in \@script_initial_cache\@\n)
-  endif()
-  configure_file(${script_filename}.in ${script_filename})
+  file(GENERATE OUTPUT ${script_filename} CONTENT ${script_initial_cache})
 endfunction()


-- 
2.3.2 (Apple Git-55)

From ef7f2279ccc4c8b557bb61310283c64f3901b7d8 Mon Sep 17 00:00:00 2001
From: Pokrovskiy pok...@amazon.com
Date: Mon, 20 Apr 2015 23:28:21 -0700
Subject: [PATCH 2/3]  ExternalProject_Add: Allow generator expressions in
 CMAKE_ARGS when LOG_BUILD is set

---
 Modules/ExternalProject.cmake | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1c7cf51..c238d60 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1299,14 +1299,14 @@ endif()
   endif()
 endforeach()
 set(code ${code}set(command \${cmd}\)${code_execute_process})
-file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake ${code})
+file(GENERATE OUTPUT ${stamp_dir}/${name}-${step}-impl.cmake
CONTENT ${code})
 set(command ${CMAKE_COMMAND} -Dmake=\${make}
-Dconfig=\${config} -P ${stamp_dir}/${name}-${step}-impl.cmake)
   endif()

   # Wrap the command in a script to log output to files.
   set(script ${stamp_dir}/${name}-${step}.cmake)
   set(logbase ${stamp_dir}/${name}-${step})
-  file(WRITE ${script} 
+  set(code 
 ${code_cygpath_make}
 set(command \${command}\)
 execute_process(
@@ -1327,6 +1327,7 @@ else()
   message(STATUS \\${msg}\)
 endif()
 )
+  file(GENERATE OUTPUT ${script} CONTENT ${code})
   set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script})
   set(${cmd_var} ${command} PARENT_SCOPE)
 endfunction()
-- 
2.3.2 (Apple Git-55)

From 722d2d93d41a8a9aa406485a903a2813a620a1e8 Mon Sep 17 00:00:00 2001
From: Pokrovskiy pok...@amazon.com
Date: Mon, 20 Apr 2015 23:51:28 -0700
Subject: [PATCH 3/3] ExternalProject_Add: per-configuration init and log
 scripts

---
 Modules/ExternalProject.cmake | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index c238d60..03d6b82 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1299,12 +1299,12 @@ endif()
   endif()
 endforeach()
 set(code ${code}set(command \${cmd}\)${code_execute_process})
-file(GENERATE OUTPUT ${stamp_dir}/${name}-${step}-impl.cmake
CONTENT ${code})
+file(GENERATE OUTPUT
${stamp_dir}/${name}-${step}-$CONFIG-impl.cmake CONTENT ${code})
 set(command ${CMAKE_COMMAND} -Dmake=\${make}
-Dconfig=\${config} -P ${stamp_dir}/${name}-${step}-impl.cmake)
   endif()

   # Wrap the command in a script to log output to files.
-  set(script ${stamp_dir}/${name}-${step}.cmake)
+  set(script ${stamp_dir}/${name}-${step}-$CONFIG.cmake)
   set(logbase ${stamp_dir}/${name}-${step})
   set(code 
 ${code_cygpath_make}
@@ -2052,7 +2052,7 @@ function(_ep_add_configure_command name)
 get_property(cmake_cache_default_args TARGET ${name} PROPERTY
_EP_CMAKE_CACHE_DEFAULT_ARGS)

 if(cmake_cache_args OR cmake_cache_default_args)
-  set(_ep_cache_args_script ${tmp_dir}/${name}-cache.cmake)
+  set(_ep_cache_args_script ${tmp_dir}/${name}-cache-$CONFIG.cmake)
   if(cmake_cache_args)
 _ep_command_line_to_initial_cache(script_initial_cache_force
${cmake_cache_args} 1)
   endif()
-- 
2.3.2 (Apple Git-55)

On Mon, Apr 20, 2015 at 6:26 PM, Andrey Pokrovskiy
wonder.m...@gmail.com wrote:
 Please disregard my previous email, didn't notice Brad's reply.

 On Mon, Apr 20, 2015 at 6:25 PM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 Will it go to mainline? Is there any formal code review process?

 On Fri, Apr 17, 2015 at 10:58 AM, David Cole dlrd...@aol.com wrote:
 Great -- thanks

Re: [cmake-developers] ExternalProject can't have interface library as a dependency

2015-04-21 Thread Andrey Pokrovskiy
As far as I understand, IMPORT libraries are for different purposes.
They should be used for files that are already exist. In other words,
to import existing artifacts into the build system. I don't remember
the exact details, but last time I tried to use IMPORT library for
such purpose there was a cmake error saying that path (include dir or
library) not exists, while it should.
In my case openssl is also generated as a result of an external
project, so I have to use INTERFACE library.

On Tue, Apr 21, 2015 at 10:10 AM, Stephen Kelly steve...@gmail.com wrote:
 Andrey Pokrovskiy wrote:

 [Moved from cmake users mailing list]

 I have the following construction:

 ExternalProject_Add(
 websockets_ep
 DEPENDS ev openssl
 ...)

 But it so happened, that openssl is an INTERFACE library. It is an
 INTERFACE library, because I created it with add_library(openssl
 INTEFACE) and then populated corresponding INCLUDE and LINK
 properties.

 Sorry, I forgot to follow up on this on the user list.

 You probably want an IMPORT library instead of an INTERFACE one. That might
 already work for your dependency case with existing cmake releases.

 Thanks,

 Steve.




 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more 
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] ExternalProject can't have interface library as a dependency

2015-04-21 Thread Andrey Pokrovskiy
[Moved from cmake users mailing list]

I have the following construction:

ExternalProject_Add(
websockets_ep
DEPENDS ev openssl
...)

But it so happened, that openssl is an INTERFACE library. It is an
INTERFACE library, because I created it with add_library(openssl
INTEFACE) and then populated corresponding INCLUDE and LINK
properties. And I get an obscure error:

CMake Error at 
/usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2031
(get_property):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property _EP_IS_EXTERNAL_PROJECT is not allowed.
Call Stack (most recent call first):
  /usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2328
(_ep_add_configure_command)
  src/libwebsockets/CMakeLists.txt:21 (ExternalProject_Add)

Apparently because there is a check inside get_property() that
whitelists what properties could be queried.

My first idea was that having a whitelist for get_property() is
probably not that good idea.
But then I realized that I don't understand why ExternalProject cares
about whether dependency is also an external project. What the
difference it makes? Does that means that it's not safe to use
external project target with add_dependencies()?

ExternalProject_Add() already have code that should cover all cases:

  # Depend on other external projects (target-level).
  get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
  foreach(arg IN LISTS deps)
add_dependencies(${name} ${arg})
  endforeach()

Why there is a special case when dependency is also an external project?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] ExternalProject can't have interface library as a dependency

2015-04-21 Thread Andrey Pokrovskiy
Thanks for fixing that, Brad!

 Why there is a special case when dependency is also an external project?

 When one external project depends on another then we add both
 the target-level ordering dependencies (add_dependencies) and
 add file-level dependencies on the stamp files so that things
 re-run when needed.

I understand that, but I still don't understand why there is a need in
file-level dependencies at all. When target level dependency will not
be enough?
And what if I want to have a dependency on external project target in
my code? Do I need to apply the same hack to also add a file-level
dependency?

On Tue, Apr 21, 2015 at 8:38 AM, Brad King brad.k...@kitware.com wrote:
 On 04/21/2015 03:34 AM, Andrey Pokrovskiy wrote:
 CMake Error at 
 /usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2031
 (get_property):
   INTERFACE_LIBRARY targets may only have whitelisted properties.  The
   property _EP_IS_EXTERNAL_PROJECT is not allowed.
 Call Stack (most recent call first):
   /usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2328
 (_ep_add_configure_command)
   src/libwebsockets/CMakeLists.txt:21 (ExternalProject_Add)

 Fixed:

  ExternalProject: Allow dependencies on INTERFACE libraries
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bce6c5d

 My first idea was that having a whitelist for get_property() is
 probably not that good idea.

 The idea is to restrict INTERFACE libraries as much as possible to
 intended use cases so we can expand later without breaking projects
 depending on undefined behavior.

 Why there is a special case when dependency is also an external project?

 When one external project depends on another then we add both
 the target-level ordering dependencies (add_dependencies) and
 add file-level dependencies on the stamp files so that things
 re-run when needed.

 -Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] ExternalProject_Add: Allow generator expressions in CMAKE_CACHE_ARGS

2015-04-20 Thread Andrey Pokrovskiy
Please disregard my previous email, didn't notice Brad's reply.

On Mon, Apr 20, 2015 at 6:25 PM, Andrey Pokrovskiy
wonder.m...@gmail.com wrote:
 Will it go to mainline? Is there any formal code review process?

 On Fri, Apr 17, 2015 at 10:58 AM, David Cole dlrd...@aol.com wrote:
 Great -- thanks for checking. This proposed change looks reasonable to me...

 On Fri, Apr 17, 2015 at 12:27 PM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 does the external project's configure step re-run when you edit only the 
 CMAKE_CACHE_ARGS for it?

 Yes. Verified with the following example:

 
 cmake_minimum_required(VERSION 3.2)

 project(CMakeExternalProjectGenExpr)

 include(ExternalProject)

 set(ZF_QUEUE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zf_queue.install)

 ExternalProject_Add(zf_queue_ep
 GIT_REPOSITORY https://github.com/wonder-mice/zf_queue.git
 UPDATE_COMMAND 
 INSTALL_DIR ${ZF_QUEUE_INSTALL_PREFIX}
 CMAKE_CACHE_ARGS
 -DCMAKE_INSTALL_PREFIX:string=INSTALL_DIR)

 On Fri, Apr 17, 2015 at 4:19 AM, David Cole dlrd...@aol.com wrote:
 With this change, does the external project's configure step re-run
 when you edit only the CMAKE_CACHE_ARGS for it?

 (It did with the *.in / configure_file approach...)


 On Fri, Apr 17, 2015 at 12:55 AM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 In current implementation of ExternalProject_Add generator expressions
 are supported in CMAKE_ARGS (probably by coincidence), but not in
 CMAKE_CACHE_ARGS. This patch will enable generators expressions in
 CMAKE_CACHE_ARGS.

 Use case:
 set(LIBEV_LIBRARIES $TARGET_FILE:ev)
 ExternalProject_Add(
 ...
 CMAKE_CACHE_ARGS
  -DLIBEV_LIBRARIES=${LIBEV_LIBRARIES}
 ...)

 ---
  Modules/ExternalProject.cmake | 5 +
  1 file changed, 1 insertion(+), 4 deletions(-)

 diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
 index 0c73d41..1c7cf51 100644
 --- a/Modules/ExternalProject.cmake
 +++ b/Modules/ExternalProject.cmake
 @@ -1126,10 +1126,7 @@ function(_ep_write_initial_cache target_name
 script_filename script_initial_cach
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
# Write out the initial cache file to the location specified.
 -  if(NOT EXISTS ${script_filename}.in)
 -file(WRITE ${script_filename}.in \@script_initial_cache\@\n)
 -  endif()
 -  configure_file(${script_filename}.in ${script_filename})
 +  file(GENERATE OUTPUT ${script_filename} CONTENT 
 ${script_initial_cache})
  endfunction()


 --
 2.3.2 (Apple Git-55)

 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more 
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] ExternalProject_Add: Allow generator expressions in CMAKE_CACHE_ARGS

2015-04-20 Thread Andrey Pokrovskiy
Will it go to mainline? Is there any formal code review process?

On Fri, Apr 17, 2015 at 10:58 AM, David Cole dlrd...@aol.com wrote:
 Great -- thanks for checking. This proposed change looks reasonable to me...

 On Fri, Apr 17, 2015 at 12:27 PM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 does the external project's configure step re-run when you edit only the 
 CMAKE_CACHE_ARGS for it?

 Yes. Verified with the following example:

 
 cmake_minimum_required(VERSION 3.2)

 project(CMakeExternalProjectGenExpr)

 include(ExternalProject)

 set(ZF_QUEUE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zf_queue.install)

 ExternalProject_Add(zf_queue_ep
 GIT_REPOSITORY https://github.com/wonder-mice/zf_queue.git
 UPDATE_COMMAND 
 INSTALL_DIR ${ZF_QUEUE_INSTALL_PREFIX}
 CMAKE_CACHE_ARGS
 -DCMAKE_INSTALL_PREFIX:string=INSTALL_DIR)

 On Fri, Apr 17, 2015 at 4:19 AM, David Cole dlrd...@aol.com wrote:
 With this change, does the external project's configure step re-run
 when you edit only the CMAKE_CACHE_ARGS for it?

 (It did with the *.in / configure_file approach...)


 On Fri, Apr 17, 2015 at 12:55 AM, Andrey Pokrovskiy
 wonder.m...@gmail.com wrote:
 In current implementation of ExternalProject_Add generator expressions
 are supported in CMAKE_ARGS (probably by coincidence), but not in
 CMAKE_CACHE_ARGS. This patch will enable generators expressions in
 CMAKE_CACHE_ARGS.

 Use case:
 set(LIBEV_LIBRARIES $TARGET_FILE:ev)
 ExternalProject_Add(
 ...
 CMAKE_CACHE_ARGS
  -DLIBEV_LIBRARIES=${LIBEV_LIBRARIES}
 ...)

 ---
  Modules/ExternalProject.cmake | 5 +
  1 file changed, 1 insertion(+), 4 deletions(-)

 diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
 index 0c73d41..1c7cf51 100644
 --- a/Modules/ExternalProject.cmake
 +++ b/Modules/ExternalProject.cmake
 @@ -1126,10 +1126,7 @@ function(_ep_write_initial_cache target_name
 script_filename script_initial_cach
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
# Write out the initial cache file to the location specified.
 -  if(NOT EXISTS ${script_filename}.in)
 -file(WRITE ${script_filename}.in \@script_initial_cache\@\n)
 -  endif()
 -  configure_file(${script_filename}.in ${script_filename})
 +  file(GENERATE OUTPUT ${script_filename} CONTENT 
 ${script_initial_cache})
  endfunction()


 --
 2.3.2 (Apple Git-55)

 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more 
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [PATCH] ExternalProject_Add: Allow generator expressions in CMAKE_CACHE_ARGS

2015-04-16 Thread Andrey Pokrovskiy
In current implementation of ExternalProject_Add generator expressions
are supported in CMAKE_ARGS (probably by coincidence), but not in
CMAKE_CACHE_ARGS. This patch will enable generators expressions in
CMAKE_CACHE_ARGS.

Use case:
set(LIBEV_LIBRARIES $TARGET_FILE:ev)
ExternalProject_Add(
...
CMAKE_CACHE_ARGS
 -DLIBEV_LIBRARIES=${LIBEV_LIBRARIES}
...)

---
 Modules/ExternalProject.cmake | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0c73d41..1c7cf51 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1126,10 +1126,7 @@ function(_ep_write_initial_cache target_name
script_filename script_initial_cach
   # Replace location tags.
   _ep_replace_location_tags(${target_name} script_initial_cache)
   # Write out the initial cache file to the location specified.
-  if(NOT EXISTS ${script_filename}.in)
-file(WRITE ${script_filename}.in \@script_initial_cache\@\n)
-  endif()
-  configure_file(${script_filename}.in ${script_filename})
+  file(GENERATE OUTPUT ${script_filename} CONTENT ${script_initial_cache})
 endfunction()


-- 
2.3.2 (Apple Git-55)


0001-ExternalProject_Add-Allow-generator-expressions-in-C.patch
Description: Binary data
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers