[Insight-users] Re: CMake to set up resources for
executables on OSX ?
Bill Hoffman
bill.hoffman@kitware.com
Tue, 21 Jan 2003 09:54:02 -0500
--=====================_1210464765==.ALT
Content-Type: text/plain; charset="us-ascii"
The ADD_CUSTOM_COMMAND must come after the ADD_EXECUTABLE for things to work.
-Bill
At 02:11 PM 1/21/2003 +0100, Jon Harald Kaspersen wrote:
>Hi Bill,
>
>I found that the problem is that CMake don't like extra spaces.
>
>The following lines will work :
>
>IF(APPLE)
> FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
> IF(ITK_APPLE_RESOURCE)
> ADD_CUSTOM_COMMAND(
> SOURCE RegionGrowingSegmentation
> COMMAND ${ITK_APPLE_RESOURCE}
> ARGS -t APPL /usr/local/include/FL/mac.r -o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation
> TARGET RegionGrowingSegmentation
> )
> ENDIF(ITK_APPLE_RESOURCE)
>ENDIF(APPLE)
>
>However, I can't see any result of these lines in the Makefiles. I did put the above lines in the CMakeLists.txt file in Insight/Applications/RegionGrowingSegmentation and did run CMake, but can not see any effect of these lines in the Makefile.
>What extra will be needed ?
>
>Regards
>Jon
>
>On Monday, January 20, 2003, at 02:57 PM, Bill Hoffman wrote:
>
>>I think cmake is reporting the error on the wrong line.
>>Can you create a CMakeLists.txt file with one line:
>>
>>FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
>>
>>Then run cmake on that directory.
>>I tried it here, and get no error.
>>
>>What does the rest of the CMakeLists.txt file look like?
>>
>>At 01:43 PM 1/20/2003 +0100, you wrote:
>>
>>Hi again Bill,
>>
>>I am having problems with :
>>
>>IF(APPLE)
>> FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
>>ENDIF(APPLE)
>>
>>CMake Error: Error in cmake code at
>>/Users/jonk/cvs/Insight/Applications/CMakeLists.txt:8:
>>
>>Line 8 in /Users/jonk/cvs/Insight/Applications/CMakeLists.txt is:
>> FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
>>
>>I am running the latest CVS of CMake.
>>
>>Any suggestions ?
>>
>>Regards
>>Jon
>>
>>On Friday, January 17, 2003, at 03:28 PM, Bill Hoffman wrote:
>>
>>Note quite. The VTK_APPLE_RESOURCE is defined in the FIND_PROGRAM command.
>>So, you can just change the name to ITK_APPLE_RESOURCE.
>>
>>The custom command must be done for each executable that you want to run
>>the resource program on.
>>
>>
>>So, for RegionGrowingSegmentation , you would do this:
>>
>>IF(APPLE)
>> FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
>> IF(ITK_APPLE_RESOURCE)
>> ADD_CUSTOM_COMMAND(
>> SOURCE RegionGrowingSegmentation
>> COMMAND ${VTK_APPLE_RESOURCE}
>> ARGS -t APPL /usr/local/include/FL/mac.r -o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation
>> TARGET RegionGrowingSegmentation
>> )
>> ENDIF(ITK_APPLE_RESOURCE)
>>ENDIF(APPLE)
>>
>>
>>I guess the FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) could
>>be in the top CMakeLists.txt file for the Applications directory, and
>>then used by each application.
>>
>>With CMake 1.6 we could use a macro to make this a bit shorter.
>>Why don't you try and see if it works, and when we get it working we
>>can create the macro. Cmake 1.6 should be out of beta soon, and we
>>can then use Macros in the ITK files.
>>
>>-Bill
>>
>>-Bill
>>
>>At 03:11 PM 1/17/2003 +0100, Jon Harald Kaspersen wrote:
>>
>>Bill,
>>
>>So, I will have to add something like this to my CMakeLists.txt file in Insight/Applications/ directory :
>>
>>Is there a ITK_APPLE_RESOURCE parameter in CMake ?
>>
>>IF(APPLE)
>> FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools)
>> IF(VTK_APPLE_RESOURCE)
>> ADD_CUSTOM_COMMAND(
>> SOURCE itk
>> COMMAND ${VTK_APPLE_RESOURCE}
>> ARGS -t APPL /usr/local/include/FL/mac.r -o ${EXECUTABLE_OUTPUT_PATH}
>> TARGET itk
>> )
>> ENDIF(VTK_APPLE_RESOURCE)
>>ENDIF(APPLE)
>>
>>
>>Regards
>>Jon
>>
>>On Friday, January 17, 2003, at 02:54 PM, Bill Hoffman wrote:
>>
>>Yes, this can be done, and is being done in VTK, here is
>>what the code looks like in VTK:
>>
>>
>>IF(VTK_USE_CARBON)
>> FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools)
>> IF(VTK_APPLE_RESOURCE)
>> ADD_CUSTOM_COMMAND(
>> SOURCE vtk
>> COMMAND ${VTK_APPLE_RESOURCE}
>> ARGS Carbon.r -o ${EXECUTABLE_OUTPUT_PATH}/vtk
>> TARGET vtk
>> )
>> ENDIF(VTK_APPLE_RESOURCE)
>>ENDIF(VTK_USE_CARBON)
>>
>>========================================================
>>Jon Harald Kaspersen Tel: +47 73 59 75 89
>>Ph.D. Mechanical Engineering Mob: +47 93 03 65 90
>>Senior Scientist Pager +47 96 84 29 94
>>SINTEF Unimed - Ultralyd Fax: +47 73 59 78 73
>>N-7465 Trondheim
>>NORWAY e-mail: Jon.H.Kaspersen@unimed.sintef.no
>> WEB: <http://www.us.unimed.sintef.no/>http://www.us.unimed.sintef.no/
>>========================================================
>>
>></blockquote></x-html>
>>
>>========================================================
>>Jon Harald Kaspersen Tel: +47 73 59 75 89
>>Ph.D. Mechanical Engineering Mob: +47 93 03 65 90
>>Senior Scientist Pager +47 96 84 29 94
>>SINTEF Unimed - Ultralyd Fax: +47 73 59 78 73
>>N-7465 Trondheim
>>NORWAY e-mail: Jon.H.Kaspersen@unimed.sintef.no
>> WEB: http://www.us.unimed.sintef.no/
>>========================================================
>>
>></blockquote></x-html>
>>
>========================================================
>Jon Harald Kaspersen Tel: +47 73 59 75 89
>Ph.D. Mechanical Engineering Mob: +47 93 03 65 90
>Senior Scientist Pager +47 96 84 29 94
>SINTEF Unimed - Ultralyd Fax: +47 73 59 78 73
>N-7465 Trondheim
>NORWAY e-mail: Jon.H.Kaspersen@unimed.sintef.no
> WEB: <http://www.us.unimed.sintef.no/>http://www.us.unimed.sintef.no/
>========================================================
>
></blockquote></x-html>
--=====================_1210464765==.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<body>
The ADD_CUSTOM_COMMAND must come after the ADD_EXECUTABLE for things to
work.<br><br>
-Bill<br><br>
<br>
At 02:11 PM 1/21/2003 +0100, Jon Harald Kaspersen wrote:<br>
<blockquote type=cite class=cite cite>Hi Bill, <br><br>
I found that the problem is that CMake don't like extra spaces.
<br><br>
The following lines will work : <br><br>
IF(APPLE) <br>
FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br>
IF(ITK_APPLE_RESOURCE) <br>
ADD_CUSTOM_COMMAND( <br>
SOURCE RegionGrowingSegmentation <br>
COMMAND ${ITK_APPLE_RESOURCE} <br>
ARGS -t APPL /usr/local/include/FL/mac.r
-o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation <br>
TARGET RegionGrowingSegmentation <br>
) <br>
ENDIF(ITK_APPLE_RESOURCE) <br>
ENDIF(APPLE) <br><br>
However, I can't see any result of these lines in the Makefiles. I
did put the above lines in the CMakeLists.txt file in
Insight/Applications/RegionGrowingSegmentation and did run CMake, but can
not see any effect of these lines in the Makefile. <br>
What extra will be needed ? <br><br>
Regards <br>
Jon <br><br>
On Monday, January 20, 2003, at 02:57 PM, Bill Hoffman wrote: <br><br>
<blockquote type=cite class=cite cite>I think cmake is reporting the
error on the wrong line. <br>
Can you create a CMakeLists.txt file with one line: <br><br>
FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br><br>
Then run cmake on that directory. <br>
I tried it here, and get no error. <br><br>
What does the rest of the CMakeLists.txt file look like? <br><br>
At 01:43 PM 1/20/2003 +0100, you wrote: <br><br>
Hi again Bill, <br><br>
I am having problems with : <br><br>
IF(APPLE) <br>
FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br>
ENDIF(APPLE) <br><br>
CMake Error: Error in cmake code at <br>
/Users/jonk/cvs/Insight/Applications/CMakeLists.txt:8: <br><br>
Line 8 in /Users/jonk/cvs/Insight/Applications/CMakeLists.txt is: <br>
FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br><br>
I am running the latest CVS of CMake. <br><br>
Any suggestions ? <br><br>
Regards <br>
Jon <br><br>
On Friday, January 17, 2003, at 03:28 PM, Bill Hoffman wrote: <br><br>
Note quite. The VTK_APPLE_RESOURCE is defined in the
FIND_PROGRAM command. <br>
So, you can just change the name to ITK_APPLE_RESOURCE. <br><br>
The custom command must be done for each executable that you want to run
<br>
the resource program on. <br><br>
<br>
So, for RegionGrowingSegmentation , you would do this: <br><br>
IF(APPLE) <br>
FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br>
IF(ITK_APPLE_RESOURCE) <br>
ADD_CUSTOM_COMMAND( <br>
SOURCE RegionGrowingSegmentation <br>
COMMAND ${VTK_APPLE_RESOURCE} <br>
ARGS -t APPL /usr/local/include/FL/mac.r
-o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation <br>
TARGET RegionGrowingSegmentation <br>
) <br>
ENDIF(ITK_APPLE_RESOURCE) <br>
ENDIF(APPLE) <br><br>
<br>
I guess the FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) could
<br>
be in the top CMakeLists.txt file for the Applications directory, and
<br>
then used by each application. <br><br>
With CMake 1.6 we could use a macro to make this a bit shorter. <br>
Why don't you try and see if it works, and when we get it working we
<br>
can create the macro. Cmake 1.6 should be out of beta soon,
and we <br>
can then use Macros in the ITK files. <br><br>
-Bill <br><br>
-Bill <br><br>
At 03:11 PM 1/17/2003 +0100, Jon Harald Kaspersen wrote: <br><br>
Bill, <br><br>
So, I will have to add something like this to my CMakeLists.txt file in
Insight/Applications/ directory : <br><br>
Is there a ITK_APPLE_RESOURCE parameter in CMake ? <br><br>
IF(APPLE) <br>
FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) <br>
IF(VTK_APPLE_RESOURCE) <br>
ADD_CUSTOM_COMMAND( <br>
SOURCE itk <br>
COMMAND ${VTK_APPLE_RESOURCE} <br>
ARGS -t APPL /usr/local/include/FL/mac.r
-o ${EXECUTABLE_OUTPUT_PATH} <br>
TARGET itk <br>
) <br>
ENDIF(VTK_APPLE_RESOURCE) <br>
ENDIF(APPLE) <br><br>
<br>
Regards <br>
Jon <br><br>
On Friday, January 17, 2003, at 02:54 PM, Bill Hoffman wrote: <br><br>
Yes, this can be done, and is being done in VTK, here is <br>
what the code looks like in VTK: <br><br>
<br>
IF(VTK_USE_CARBON) <br>
FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) <br>
IF(VTK_APPLE_RESOURCE) <br>
ADD_CUSTOM_COMMAND( <br>
SOURCE vtk <br>
COMMAND ${VTK_APPLE_RESOURCE} <br>
ARGS Carbon.r -o
${EXECUTABLE_OUTPUT_PATH}/vtk <br>
TARGET vtk <br>
) <br>
ENDIF(VTK_APPLE_RESOURCE) <br>
ENDIF(VTK_USE_CARBON) <br><br>
======================================================== <br>
Jon Harald
Kaspersen
Tel:
+47 73 59 75 89 <br>
Ph.D. Mechanical
Engineering
Mob:
+47 93 03 65 90 <br>
Senior
Scientist
Pager +47 96 84 29 94 <br>
SINTEF Unimed -
Ultralyd
Fax:
+47 73 59 78 73 <br>
N-7465 Trondheim <br>
NORWAY
e-mail: Jon.H.Kaspersen@unimed.sintef.no <br>
WEB:
<a href="http://www.us.unimed.sintef.no/"><font color="#1A1AFF"><u>http://www.us.unimed.sintef.no/</a>
<br>
</u></font>======================================================== <br><br>
</blockquote></x-html> <br><br>
======================================================== <br>
Jon Harald Kaspersen Tel: +47 73 59 75 89 <br>
Ph.D. Mechanical Engineering Mob: +47 93 03 65 90 <br>
Senior Scientist Pager +47 96 84 29 94 <br>
SINTEF Unimed - Ultralyd Fax: +47 73 59 78 73 <br>
N-7465 Trondheim <br>
NORWAY e-mail: Jon.H.Kaspersen@unimed.sintef.no <br>
WEB: <font color="#1A1AFF"><u>http://www.us.unimed.sintef.no/ <br>
</u></font>======================================================== <br><br>
</blockquote></x-html> <br><br>
</blockquote>======================================================== <br>
Jon Harald Kaspersen<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>Tel: <x-tab> </x-tab><x-tab> </x-tab>+47 73 59 75 89 <br>
Ph.D. Mechanical Engineering<x-tab> </x-tab><x-tab> </x-tab>Mob:<x-tab> </x-tab><x-tab> </x-tab>+47 93 03 65 90 <br>
Senior Scientist<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>Pager<x-tab> </x-tab>+47 96 84 29 94 <br>
SINTEF Unimed - Ultralyd<x-tab> </x-tab><x-tab> </x-tab>Fax: <x-tab> </x-tab><x-tab> </x-tab>+47 73 59 78 73 <br>
N-7465 Trondheim <br>
NORWAY<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>e-mail:<x-tab> </x-tab>Jon.H.Kaspersen@unimed.sintef.no <br>
<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>WEB:<x-tab> </x-tab><a href="http://www.us.unimed.sintef.no/"><font color="#1A1AFF"><u>http://www.us.unimed.sintef.no/</a></u></font> <br>
======================================================== <br><br>
</blockquote></x-html> </blockquote></body>
</html>
--=====================_1210464765==.ALT--