[Insight-developers] Configuring a subdirectory with CMake

Miller, James V (Research) millerjv at crd.ge.com
Wed Jul 28 09:30:18 EDT 2004


There seems to be a common trend in users building the InsightApplications
project where they try to run cmake within a
subdirectory to try to configure just that application.  The
InsightApplications cmake configurations are not setup to allow a 
user to configure a subdirectory without configuring the root directory.

We may have the same issue in the example directories in Insight.

To date, we have been treating this as a training problem. Telling users
they need to run cmake from the root directory and use the cmake
configuration tools to select the subdirectories they want to build
(for the cases where we have a setting to turn on/off a subdirectory).

Is there a way in CMake, that we can place something in a subdirectories
CMakeLists.txt file such that if cmake is run on that CMakeLists.txt 
file without running from the root directory, that we can warn the 
user.

Maybe it is something as simple as: if the first CMakeLists.txt file
processed by CMake does not have a PROJECT() line, then CMake issues a 
warning saying the project is missing a PROJECT() line or the user is 
configuring from a non-root directory.

Or maybe a command can be added to CMake, something like SUBPROJECT(),
that would indicate that this directory and its subdirectories are 
dependent on information from a root directory.  If CMake sees a 
SUBPROJECT() call before a PROJECT() call, then it issues a warning.

We could handle this within the CMakeLists.txt files for the project
directly, setting a variable in the root CMakeLists.txt file and 
checking that variable in the other CMakeLists.txt and issuing a 
warning as appropriate.  But this would add quite a few lines to 
every CMakeLists.txt file in the project.

Any other suggestions?  

Jim


-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Tuesday, July 27, 2004 10:35 PM
To: Huss
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Building Insight Applications



Hi Huss,

Your messaage is not clear.

1) First you say that you configured and build InsightApplications-1.6.0,

2) Then you say that you are confused about how to build
     MultiResMIregistration  under InsightApplications-1.6.0.

If you already build InsightApplications-1.6.0, then the application
MulitResMIregistration should have been build as part of the build
of the entire package.

It seems that you are making the common mistake of trying to configure
an individual application.  Don't do that, you must configure the
applications from the top directory InsightApplications.

Then, if you want to build only one of the applications, you go in the
specific subdirectory of that application and type make (if you are
in Unix).  If you are in Windows, you load the generic .dsw and
select which project to build from inside the visual studio IDE.


You run this application in the command line, like

    ./MultiResMIRegistration    BrainWebT1toT2b.txt

These applications do  not have GUIs you cannot run them
by double-clickin on their icons.



   Regards,



--------------------------------------------------------------------
Huss wrote:

>Hello Insight Users,
>
>I was able to successfully configure and buiId the
>InsightApplications-1.6.0. But I am confused as to how  to build
>MultiResMIregisteration under InsightApplications-1.6.0.
>If I have to configure it what should be my source and binary directory. 
>
>Also, I went over the READ Me file in source code directory and i made
>the parameter file which has to be passed as an argument. I am also
>confused as to where do I specify which file has to be passed in?
>
>Thanks for your help
>Huss
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>  
>




_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-developers mailing list