Re: [CMake] CPack Multicore Usage

2017-07-24 Thread Chuck Atkins
>
> cause cpack does not "rebuild" the software again, it uses the compiled
> software and just starts the "install" into its _CPack_Packages
> subdirectories
>

Just running `cpack` does not.  However, CMake does generate a "package"
make target that is tied into your dependencies, so if instead of running
`make -jN; cpack` you could also run 'make -jN package' which will run the
build, since it's a dependency of the package target.

- Chuck
-- 

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] How do I specify VTK minimum version?

2017-07-24 Thread David Cole via CMake
You don't have to ask for a specific version. You can just do:

find_package(VTK REQUIRED)

if you don't really care what version is found.

Or if you need >= 7, you can do it like that and then check what
version was actually found, and error out yourself if it is too old.


HTH,
David C.



On Mon, Jul 24, 2017 at 10:52 AM, Victor Lamoine
 wrote:
> Thank you for the answers.
>
> I used this script to fix my problem:
>
> find_package(VTK 7.1.0 QUIET)
> if (NOT VTK_FOUND)
>   find_package(VTK 8.0.0 REQUIRED)
> endif()
> include(${VTK_USE_FILE})
>
> Of course this will only work until there is a VTK 9.x.x version.
>
> --
>
> 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


Re: [CMake] How do I specify VTK minimum version?

2017-07-24 Thread Victor Lamoine
Thank you for the answers.

I used this script to fix my problem:

find_package(VTK 7.1.0 QUIET)
if (NOT VTK_FOUND)
  find_package(VTK 8.0.0 REQUIRED)
endif()
include(${VTK_USE_FILE})

Of course this will only work until there is a VTK 9.x.x version.

-- 

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] "Modern" approach to optional/multiple configurations?

2017-07-24 Thread Nicholas Devenish
Hi Again,

I was asked to link to the background discussion for this (good point!).
The actual post was:
https://lists.boost.org/Archives/boost/2017/07/237490.php

and there's quite a bit of talk in that thread and a few similarly-named
others about CMake. This announcement seems to have stirred up some old/new
controversies, and I'm pretty sure there is a decent amount of
misunderstanding/old assumptions about CMake.

I was just rather taken back by this statement because I've been trying to
research "Modern" CMake and hadn't encountered anything like this. Perhaps
I'm merely imagining something wildly different from the intention.

Nick


On Mon, Jul 24, 2017 at 7:46 PM, Nicholas Devenish 
> wrote:
>
>> Seen in the boost discussions on the CMake announcements:
>>
>>
>>> > The rest can be implemented straightforwardly as cache options so that
>>> > you can run cmake with options like
>>> >
>>> >   -Dvalgrind=OFF -Dtransactional-memory=ON -Dsegmented-stacks=ON [-D…]
>>> ...
>>
>> Secondly, in cmake 3 we try not to configure things using -D as we did
>>> in cmake 2. Instead we make targets customised for that build
>>> combination. The user then chooses to make or link to those targets if
>>> they want those targets.
>>>
>>
>> Is this true, and is there a good example of a project with such a
>> configuration?
>>
>> I've been trying to learn the more modern approaches to writing
>> CMakeLists recently, and haven't come across such advice - I was under the
>> impression that cache-set options (that the build can make decisions on)
>> was still the recommended 'clean' way, and then options (and even extra
>> sources, dependencies) can be added to each target as required.
>>
>> As I imagine what this is saying, It seems that target-per-configuration
>> would just lead to an explosion of duplicated targets and duplicated code,
>> especially through every permutation of several different options?
>>
>> Part of the niceness of target-oriented dependencies was just having one
>> thing to link to and depending on the configuration, that target would be
>> the correct one (and pass through it's configuration).
>>
>> Nick
>>
>
-- 

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] CPack: Create debian packge for each sub-project

2017-07-24 Thread DKLind
Here's a little trick I learned. Executing the custom target, "make
package_target target=xyz", will build the target and call cpack to create
the package. Additional parameters can be passed by putting the target value
in quotes (make package_target target="xyz -j4").

Executing cpack causes the target to be built. But, if you want to see the
output of make, before cpack, "COMMAND make ${PARAMS}" will do that.

set(PARAMS
"$(if $(target),$(target))"
)
string(REPLACE " " ";" PARAMS ${PARAMS})

add_custom_target(package_target
COMMAND make ${PARAMS}
COMMAND cpack -D CPACK_COMPONENTS_ALL=${PARAMS}
)



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/CPack-Create-debian-packge-for-each-sub-project-tp7595889p7595912.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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] Append to property COMPILE_DEFINITIONS

2017-07-24 Thread Craig Scott
On Mon, Jul 24, 2017 at 12:32 PM, Florian Lindner 
wrote:

>
>
> Am 22.07.2017 um 15:36 schrieb Craig Scott:
> >
> > On Tue, Jul 18, 2017 at 8:50 PM, Florian Lindner  > wrote:
> >
> > #Works, but I would prefer to have it just once for all targets and
> at the top of the file
> > set_property(TARGET testprecice APPEND
> >   PROPERTY COMPILE_DEFINITIONS "FOO")
> >
> > > BTW, you don't include the -D when adding to COMPILE_DEFINITIONS,
> just put FOO, not -DFOO. Have a read of the docs, they may give you other
> clues for this property (e.g. using the ..._CONFIG variant of it).
> >
> > Yeah, I found out that I don't have to add -D. The docs say that
> generator expressions are preferable to using _CONFIG
> > variant.
> >
> >
> > So just to be crystal clear, this is what I would have expected to work
> if you wanted the symbol FOO to be defined for
> > Debug builds for all targets in the current directory and below:
> >
> > set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
> $<$:FOO>)
>
> Put that in my CMakeLists.txt. Works, but only when I build in the same
> directory where the CMakeLists.txt file is
> located, i.e. in source builds. That way:
>
> set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY
> COMPILE_DEFINITIONS  $<$:FOO>)
>
> it works also out of tree.
>

Not sure why you had to do that, but at least you found a way to get it to
work. There's probably something in your directory structure or something
else I'm not seeing which is causing the appearance of this directory
property to only work if you set it for the top of your source tree.




>
> Still, I don't undertand what is wrong with:
>
> set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
> $<$:-FOO>)
>

Properties can be defined with an INHERITED option
. If a
directory property is defined with that option, then if you try to get the
directory property's value but it is not set, then CMake will look for a
global property with the same name instead and return that value. In this
case though, the COMPILE_DEFINITIONS directory property does not behave as
though it was defined with the INHERITED option, so you don't get that
fallback behaviour. I'm not sure if any of CMake's predefined properties
behave as though they supported INHERITED, but doing a quick test just now
confirms that it isn't supported for COMPILE_DEFINITIONS at least. Note
that properties like COMPILE_DEFINITIONS are set up internally within
CMake's C++ code, not via modules where the define_property() command would
be relevant. I mention it here just so you get the full picture in case you
see the fallback behaviour somewhere else and wonder why it doesn't apply
here.



>
> > Note that this directory property is NOT used to initialise the
> corresponding target property. Rather, BOTH are combined
> > to give the final set of command line compile definitions. It does not
> matter whether this directory property is set
> > before or after you call add_executable() within the same CMakeLists.txt
> file (or more accurately, within the same
> > directory scope).
> >
> >
> >
> > >
> > >
> > > On Tue, Jul 18, 2017 at 1:21 PM, Florian Lindner <
> mailingli...@xgm.de   mailingli...@xgm.de >> wrote:
> > >
> > > Am 18.07.2017 um 10:59 schrieb Craig Scott:
> > > > You appear to be setting a GLOBAL property where you
> probably meant DIRECTORY. You could also consider setting the
> > > > target property instead rather than applying it to all
> targets (unless that's what you want).
> > >
> > > I tried to set the property on all targets, therefore I
> thought GLOBAL is the right thing.
> > >
> > > However,
> > >
> > > set_property(DIRECTORY "${CMAKE_SOURCE_DIR}/src" APPEND
> > >   PROPERTY COMPILE_DEFINITIONS "-DFOO")
> > >
> > > hasn't had any effect either.
> > >
> > > set_property(TARGET testprecice APPEND
> > >   PROPERTY COMPILE_DEFINITIONS "FOO")
> > >
> > > works. But setting it on all targets is exactly what I want.
> How can I do that?
> > >
> > > Best,
> > > Florian
> > >
> > > >
> > > >
> > > > On Tue, Jul 18, 2017 at 12:56 PM, Florian Lindner <
> mailingli...@xgm.de   mailingli...@xgm.de >
> > > 
>  > > >
> > > > Hello,
> > > >
> > > > I want to add compile definitions. Since I want to use
> generator expressions, I can't use add_definitions, but
> > > have to
> > > > use the COMPILE_DEFINITIONS property, but neither:
> > > >
> > > > set_property(GLOB

Re: [CMake] Boost is planning to switch from bjam to CMake!

2017-07-24 Thread Michael Jackson
Let's hope this try actually works. It was tried 8 years ago but some of 
the boost developers really fought the transition. Hopefully with the 
support of the steering committee it will work. Let's all welcome the 
boost devs into the CMake community with wide open arms.

--
Mike Jackson  [mike.jack...@bluequartz.net]


Bo Zhou wrote:

Good news !

Hopefully the bcp would also work with CMake so only requires component
would be installed.


--

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] How do I specify VTK minimum version?

2017-07-24 Thread Elvis Stansvik
2017-07-24 12:23 GMT+02:00 Rolf Eike Beer :
> Am Dienstag, 11. Juli 2017, 15:18:11 schrieb Victor Lamoine:
>> Hi,
>>
>> I am using CMake to set up a VTK project. Our project requires VTK to be
>> version 7.1 or newer. I'm using Ubuntu 16.04 with CMake 3.5.1.
>>
>
>> find_package(VTK 7.1 REQUIRED)
> […]
>>   The following configuration files were considered but not accepted:
>>
>> /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake, version: 8.0.0
>> /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0
>>
>> I have also tried find_package(VTK 7.1*.0* REQUIRED), without success.
>>
>> Why isn't VTK 8.0.0 accepted? It is a greater version number so I expected
>> it to be ok. How do I specify that I want VTK 7.1 OR newer?
>
> It could be that VTK sets in it's config file "same major version"
> compatibility.

Indeed. This comment from VTKConfigVersion.cmake explains it:

# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.

Elvis

>
> Eike
> --
>
> 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

Re: [CMake] How do I specify VTK minimum version?

2017-07-24 Thread Rolf Eike Beer
Am Dienstag, 11. Juli 2017, 15:18:11 schrieb Victor Lamoine:
> Hi,
> 
> I am using CMake to set up a VTK project. Our project requires VTK to be
> version 7.1 or newer. I'm using Ubuntu 16.04 with CMake 3.5.1.
> 

> find_package(VTK 7.1 REQUIRED)
[…]
>   The following configuration files were considered but not accepted:
> 
> /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake, version: 8.0.0
> /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0
> 
> I have also tried find_package(VTK 7.1*.0* REQUIRED), without success.
> 
> Why isn't VTK 8.0.0 accepted? It is a greater version number so I expected
> it to be ok. How do I specify that I want VTK 7.1 OR newer?

It could be that VTK sets in it's config file "same major version" 
compatibility.

Eike

signature.asc
Description: This is a digitally signed message part.
-- 

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

[CMake] "Modern" approach to optional/multiple configurations?

2017-07-24 Thread Nicholas Devenish
Seen in the boost discussions on the CMake announcements:


> > The rest can be implemented straightforwardly as cache options so that
> > you can run cmake with options like
> >
> >   -Dvalgrind=OFF -Dtransactional-memory=ON -Dsegmented-stacks=ON [-D…]
> ...

Secondly, in cmake 3 we try not to configure things using -D as we did
> in cmake 2. Instead we make targets customised for that build
> combination. The user then chooses to make or link to those targets if
> they want those targets.
>

Is this true, and is there a good example of a project with such a
configuration?

I've been trying to learn the more modern approaches to writing CMakeLists
recently, and haven't come across such advice - I was under the impression
that cache-set options (that the build can make decisions on) was still the
recommended 'clean' way, and then options (and even extra sources,
dependencies) can be added to each target as required.

As I imagine what this is saying, It seems that target-per-configuration
would just lead to an explosion of duplicated targets and duplicated code,
especially through every permutation of several different options?

Part of the niceness of target-oriented dependencies was just having one
thing to link to and depending on the configuration, that target would be
the correct one (and pass through it's configuration).

Nick
-- 

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] How do I specify VTK minimum version?

2017-07-24 Thread Victor Lamoine
Hello,

I am still stuck with this problem, I don't understand what's wrong.

Is my question unclear?
Do I not provide enough information?

Please ask for additional information if I forgot something.

Bye

-- 

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] CPack Multicore Usage

2017-07-24 Thread Jörg Kreuzberger
I think i had a wrong understanding of the cpack process itself.
so i did a cmake configure and called cpack to build the software and generate 
the packages (deb, tgz)
but better would be to
configure, build with make -jx and then call cpack, cause cpack does not 
"rebuild" the software again, it uses the compiled software and just starts the 
"install" into its _CPack_Packages subdirectories

Thank for your patience :-)


-Ursprüngliche Nachricht-
Von:Chuck Atkins 
Gesendet:   Fr 21.07.2017 21:32
Betreff:Re: [CMake] CPack Multicore Usage
An: Konstantin Tokarev ; 
CC: Jörg Kreuzberger ; cmake@cmake.org; 
>  
> > In calls to cpack only one core is used if Makefiles are used. Is there any 
> option to enable multicore?
> 
> It depends on what your trying to achieve.  Typically the bottleneck for 
> CPack 
> is in the compression step of the resulting tar (or rpm, etc.).  In that 
> case, 
> CMake is limited by the libarchive, libz, libbz2, liblzma, etc. 
> implementations 
> it's linked to, which are typically single threaded.  It's really no 
> different 
> than taking an install tree and running "tar -czf foo.tgz 
> /path/t/foo-prefix".  
> So in that sense, even if you can parallelizes the "temporary" install step 
> where it collects the files to packages, actually generating and compressing 
> the package, which is the costly part, will likely remain a single process.
> 
> 
> 
>

-- 

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