Re: [cmake-developers] FindProtobuf backward compatibility issue for PROTOBUF_IMPORT_DIRS

2016-08-02 Thread Brad King
On 07/29/2016 11:10 PM, Konstantin Sinitsyn wrote:
> After recent changes in FindProtobuf.cmake protobuf_generate_cpp
> doesn't take into account PROTOBUF_IMPORT_DIRS (in upper case) anymore.
[snip]
> Here's the patch to fix this:

Thanks, applied:

 FindProtobuf: Restore support for PROTOBUF_IMPORT_DIRS
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5790d9b6

I've queued this for merge to 'release' for 3.6.2.

-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] FindProtobuf backward compatibility issue for PROTOBUF_IMPORT_DIRS

2016-07-29 Thread Konstantin Sinitsyn
After recent changes in FindProtobuf.cmake protobuf_generate_cpp doesn't
take into account PROTOBUF_IMPORT_DIRS (in upper case) anymore.

The issue was introduced by this change:
http://public.kitware.com/pipermail/cmake-developers/2016-March/027910.html
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7b09e7f

As far as I understand issue is caused by the fact that code that changes
uppercase to camelcase is executed only when we call find_package, but the
way it's sometimes used is

find_package(Protobuf REQUIRED)

set(PROTOBUF_IMPORT_DIRS ./includedir1)
protobuf_generate_cpp(SRCS1 HDRS1 PROTOS2)

set(PROTOBUF_IMPORT_DIRS ./includedir2)
protobuf_generate_cpp(SRCS2 HDRS2 PROTOS2)

set(PROTOBUF_IMPORT_DIRS ./includedir3)
protobuf_generate_cpp(SRCS3 HDRS3 PROTOS3)

But now protobuf_generate_cpp only looks at camel case variable.


Here's the patch to fix this:

diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index c90a0a2..6c04de3 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -129,6 +129,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
 set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
   endif()

+  if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
+set(Protobuf_IMPORT_DIRS ${PROTOBUF_IMPORT_DIRS})
+  endif()
+
   if(DEFINED Protobuf_IMPORT_DIRS)
 foreach(DIR ${Protobuf_IMPORT_DIRS})
   get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
@@ -187,6 +191,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
 set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
   endif()

+  if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
+set(Protobuf_IMPORT_DIRS ${PROTOBUF_IMPORT_DIRS})
+  endif()
+
   if(DEFINED Protobuf_IMPORT_DIRS)
 foreach(DIR ${Protobuf_IMPORT_DIRS})
   get_filename_component(ABS_PATH ${DIR} ABSOLUTE)

~
Konstantin
-- 

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