[ITK Community] [Insight-developers] CMake variables and preprocessor directives

Padfield, Dirk R (GE Global Research) padfield at research.ge.com
Thu Feb 20 12:11:48 EST 2014


Hi Brads,

Thanks for your help with this!  For posterity, I wanted to mention that the problem was that I neglected to #include my local configure file at the top of my test file.

Thanks,
Dirk

________________________________________
From: Brad King [brad.king at kitware.com]
Sent: Thursday, February 20, 2014 10:15 AM
To: Bradley Lowekamp
Cc: Padfield, Dirk R (GE Global Research); insight-developers at itk.org
Subject: Re: [Insight-developers] CMake variables and preprocessor directives

On 02/20/2014 10:04 AM, Bradley Lowekamp wrote:
> add them as command line defines with some add_definition commands?

If the application specifies its own list of components when calling
find_package(ITK) then it already knows what modules it is using.
It is only when using "all" modules that happen to have been built
with ITK that the application may need to get information like this.
The ITKConfig.cmake file already provides it as:

- ITK_MODULES_ENABLED = modules enabled when ITK was built
- ITK_MODULES_REQUESTED = modules requested by app, or all enabled

If an application needs this information at the preprocessor level
it should do its own thing based on its own needs.  It could be
as simple as

 set_property(DIRECTORY APPEND PROPERTY
   COMPILE_DEFINITIONS ${ITK_MODULES_REQUESTED})

but that could make command lines somewhat long.  IMO the approach
of using configure_file for specific modules is best.

-Brad K

_______________________________________________
Powered by www.kitware.com

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

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers



More information about the Community mailing list