[Insight-developers] cmake

Bill Hoffman bill.hoffman@kitware.com
Wed, 25 Sep 2002 11:11:53 -0400


I think it is important to separate the Find from the Use.
It makes it much easier to deal with a failed Find.


So, you can do things like this:

IF (USE_ITK_FILE)
  INCLUDE(${USE_ITK_FILE})
  SET(HAS_ITK TRUE)
ENDIF (USE_ITK_FILE)

IF(HAS_ITK)
...

-Bill


At 11:04 AM 9/25/2002 -0400, Mark Foskey wrote:
>And, just to make sure I have this straight, Stephen's point was that we ought to be able to arrange things so that the three lines
>
>> IF (USE_ITK_FILE)
>>   INCLUDE(${USE_ITK_FILE})
>> ENDIF (USE_ITK_FILE)
>
>are unnecessary, right?
>
>Bill Hoffman wrote:
>>Your right, I missed that.
>>It should look like this:
>>PROJECT (MyProject)
>>INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
>>IF (USE_ITK_FILE)
>>  INCLUDE(${USE_ITK_FILE})
>>ENDIF (USE_ITK_FILE)
>>ADD_EXECUTABLE(MyProject main.cxx)
>>TARGET_LINK_LIBRARIES(MyProject ITKIO ITKNumerics)
>>
>>-Bill
>>At 10:45 AM 9/25/2002 -0400, Miller, James V (Research) wrote:
>>
>>>The include paths and library paths are in UseITK.cmake not FindITK.cmake
>>>
>>>
>>>>-----Original Message-----
>>>>From: Bill Hoffman [mailto:bill.hoffman@kitware.com]
>>>>Sent: Wednesday, September 25, 2002 10:39 AM
>>>>To: Stephen R. Aylward; Insight-Developers (E-mail)
>>>>Subject: Re: [Insight-developers] cmake
>>>>
>>>>
>>>>
>>>>It should add all the include paths and library paths, but not the libraries.
>>>>The users should specifiy only the libraries directly used by the application.
>>>>CMake now knows which libraries need each other.  So, the above should work with
>>>>one added line:
>>>>
>>>>TARGET_LINK_LIBRARIES(MyProject ITKNumerics ITKIO)
>>>>
>>>>(Assuming the project used ITKNumerics and ITKIO directly.   
>>>>Cmake will
>>>>add all the other libraries used by ITKNumerics and ITKIO.)  
>>>>We don't want
>>>>to force folks to link in libraries they are not using.
>>>>
>>>>If the include paths and library path is not being added, I will fix it.
>>>>
>>>>-Bill
>>>>
>>>>
>>>>At 10:14 AM 9/25/2002 -0400, Stephen R. Aylward wrote:
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>If someone does a FindITK.cmake, shouldn't we assume that 
>>>>
>>>>they want to include ITK paths and libraries?
>>>>
>>>>>There are arguments against this, but perhaps it would be 
>>>>
>>>>nice if the following CMakeLists.txt file was sufficient to compile an ITK program out of source...
>>>>
>>>>>PROJECT(MyProject)
>>>>>
>>>>>INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
>>>>>
>>>>>SET ( MYPROJECT_SRCS
>>>>>main.cxx
>>>>>)
>>>>>
>>>>>ADD_EXECUTABLE( MyProject MYPROJECT_SRCS )
>>>>
>>>>
>>>>_______________________________________________
>>>>Insight-developers mailing list
>>>>Insight-developers@public.kitware.com
>>>>http://public.kitware.com/mailman/listinfo/insight-developers
>>>
>>>_______________________________________________
>>>Insight-developers mailing list
>>>Insight-developers@public.kitware.com
>>>http://public.kitware.com/mailman/listinfo/insight-developers 
>>
>>_______________________________________________
>>Insight-developers mailing list
>>Insight-developers@public.kitware.com
>>http://public.kitware.com/mailman/listinfo/insight-developers
>
>
>-- 
>Mark Foskey    (919) 843-5436  Computer-Aided Diagnosis and Display Lab
>mark_foskey@unc.edu            Department of Radiology, CB 7515, UNC
>http://www.cs.unc.edu/~foskey  Chapel Hill, NC  27599-7515