Re: [CMake] externalproject_add and generating sources

2017-01-29 Thread David Jobet
Oh ok, I see how it works, it makes sense, but I'm somehow disappointed : in 
order to use it, I'm going to have to change my own project while I originally 
thought it was going to be a kind of FindXXX on steroid...
I'll give it a try though, tx for pointing it out.

David

Le 26 janvier 2017 13:02:43 GMT+00:00, Nicholas Braden 
 a écrit :
>You'll also want to build your own project with ExternalProject, and
>use
>the DEPENDS option to control build order. This ensures that all
>dependencies are fully installed before your own project is even
>configured. The project with all the ExternalProject calls is typically
>called a superbuild, and effectively becomes an optional convenience to
>building your own project.
>
>On Thu, Jan 26, 2017 at 3:23 AM, David Jobet 
>wrote:
>
>> Hello,
>>
>> suppose I want to use protobuf and integrate it in my project with
>> externalproject_add. (actually, I just have precompiled binaries and
>libs +
>> header files, I don't have the full sources)
>> Once the project has been 'built' (actually, installed by a custom
>> rpm-like tool to a shared path), I can use the protoc compiler to
>generate
>> protobuf c++ files (.pb.h and .pb.cpp files) from a .proto
>description file.
>> I can add_dependencies so that the external project is built before
>> projects depending on libprotobuf.a.
>>
>> However, I don't know how to do the same thing with .pb.h and .pb.cpp
>> files which use a .proto file and the protoc compiler.
>>
>> make is fine with it, but ninja complains with an error like this :
>> ninja: error:
>'/path_to_external_projects/protobuf/2.6.0.4/bin/protoc',
>> needed by 'some_project/SomeFile.pb.h', missing and no known rule to
>make it
>>
>> how can I tell ninja that protoc is going to be provided by
>> externalproject ?
>> If I use byproducts, ninja is happy, but "ninja clean" deletes
>> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc.
>> I don't want that to happen since
>/path_to_external_projects/protobuf/
>> 2.6.0.4/bin/protoc is shared with other users.
>>
>> With regards
>>
>> David
>> --
>>
>> 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
>>

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.-- 

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

Re: [CMake] externalproject_add and generating sources

2017-01-29 Thread David Jobet
Hello,

Yes, main reason is I had to hack FindProtobuf.cmake to make our existing 
project compile.
Also since I need to make it "installable", I had to add some stuff to have the 
binaries and header installed automatically when referenced.
The latter reason led me to experiment with ExternalProject.

David

Le 26 janvier 2017 16:05:47 GMT+00:00, Michael Ellery  a 
écrit :
>
>> On Jan 26, 2017, at 1:23 AM, David Jobet  wrote:
>> 
>> Hello,
>> 
>> suppose I want to use protobuf and integrate it in my project with
>externalproject_add. (actually, I just have precompiled binaries and
>libs + header files, I don't have the full sources)
>> Once the project has been 'built' (actually, installed by a custom
>rpm-like tool to a shared path), I can use the protoc compiler to
>generate protobuf c++ files (.pb.h and .pb.cpp files) from a .proto
>description file.
>> I can add_dependencies so that the external project is built before
>projects depending on libprotobuf.a.
>> 
>> However, I don't know how to do the same thing with .pb.h and .pb.cpp
>files which use a .proto file and the protoc compiler.
>> 
>> make is fine with it, but ninja complains with an error like this :
>> ninja: error:
>'/path_to_external_projects/protobuf/2.6.0.4/bin/protoc', needed by
>'some_project/SomeFile.pb.h', missing and no known rule to make it
>> 
>> how can I tell ninja that protoc is going to be provided by
>externalproject ?
>> If I use byproducts, ninja is happy, but "ninja clean" deletes
>/path_to_external_projects/protobuf/2.6.0.4/bin/protoc.
>> I don't want that to happen since
>/path_to_external_projects/protobuf/2.6.0.4/bin/protoc is shared with
>other users.
>> 
>
>I’ve never used protobufs as an external project (I’ve always just done
>a one-time setup/install)…but is there a reason you can’t just use the
>standard finder to locate it? 
>https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake
>
>-Mike

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.-- 

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

Re: [CMake] externalproject_add and generating sources

2017-01-26 Thread Michael Ellery

> On Jan 26, 2017, at 1:23 AM, David Jobet  wrote:
> 
> Hello,
> 
> suppose I want to use protobuf and integrate it in my project with 
> externalproject_add. (actually, I just have precompiled binaries and libs + 
> header files, I don't have the full sources)
> Once the project has been 'built' (actually, installed by a custom rpm-like 
> tool to a shared path), I can use the protoc compiler to generate protobuf 
> c++ files (.pb.h and .pb.cpp files) from a .proto description file.
> I can add_dependencies so that the external project is built before projects 
> depending on libprotobuf.a.
> 
> However, I don't know how to do the same thing with .pb.h and .pb.cpp files 
> which use a .proto file and the protoc compiler.
> 
> make is fine with it, but ninja complains with an error like this :
> ninja: error: '/path_to_external_projects/protobuf/2.6.0.4/bin/protoc', 
> needed by 'some_project/SomeFile.pb.h', missing and no known rule to make it
> 
> how can I tell ninja that protoc is going to be provided by externalproject ?
> If I use byproducts, ninja is happy, but "ninja clean" deletes 
> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc.
> I don't want that to happen since 
> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc is shared with other 
> users.
> 

I’ve never used protobufs as an external project (I’ve always just done a 
one-time setup/install)…but is there a reason you can’t just use the standard 
finder to locate it?  
https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake

-Mike

-- 

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

Re: [CMake] externalproject_add and generating sources

2017-01-26 Thread Nicholas Braden
You'll also want to build your own project with ExternalProject, and use
the DEPENDS option to control build order. This ensures that all
dependencies are fully installed before your own project is even
configured. The project with all the ExternalProject calls is typically
called a superbuild, and effectively becomes an optional convenience to
building your own project.

On Thu, Jan 26, 2017 at 3:23 AM, David Jobet  wrote:

> Hello,
>
> suppose I want to use protobuf and integrate it in my project with
> externalproject_add. (actually, I just have precompiled binaries and libs +
> header files, I don't have the full sources)
> Once the project has been 'built' (actually, installed by a custom
> rpm-like tool to a shared path), I can use the protoc compiler to generate
> protobuf c++ files (.pb.h and .pb.cpp files) from a .proto description file.
> I can add_dependencies so that the external project is built before
> projects depending on libprotobuf.a.
>
> However, I don't know how to do the same thing with .pb.h and .pb.cpp
> files which use a .proto file and the protoc compiler.
>
> make is fine with it, but ninja complains with an error like this :
> ninja: error: '/path_to_external_projects/protobuf/2.6.0.4/bin/protoc',
> needed by 'some_project/SomeFile.pb.h', missing and no known rule to make it
>
> how can I tell ninja that protoc is going to be provided by
> externalproject ?
> If I use byproducts, ninja is happy, but "ninja clean" deletes
> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc.
> I don't want that to happen since /path_to_external_projects/protobuf/
> 2.6.0.4/bin/protoc is shared with other users.
>
> With regards
>
> David
> --
>
> 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
>
-- 

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