[Insight-users] Adding *.h and *.txx files that are in a folder...
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Sun Sep 24 08:28:04 EDT 2006
Hi Sonali,
Can you try to add the command
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}")
in the CMakeLists.txt files in your subdirectories ?
Thanks,
Gaetan
Le Sat, 23 Sep 2006 02:36:34 +0200, Sonali Barua <barua.sonali at gmail.com>
a écrit:
> Hello,
>
> Thank you for replying.
>
> Well I am trying to build an ITK class. I have three CMakeLists.txt
> files.
>
> 1. My code is spread across three directories. Two of them are in the
> parent
> directory called ExamplePipeline3. The other two BasicFilters and Common
> are
> within this parent directory and comprises of .h and .txx files. The
> problem
> I face is that when I run make it doesn't recognise the files in the
> subdirectories BasicFilters and Common. And because of this alot of
> errors
> occur in my code.
>
> 1. The First CMakeLists.txt is in a directory called ExamplePipeline3
> PROJECT( PrimMinimumSpanningTree )
>
> FIND_PACKAGE ( ITK )
>
> IF ( ITK_FOUND )
> INCLUDE(${USE_ITK_FILE})
> ELSE (ITK_FOUND)
> MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.")
> ENDIF( ITK_FOUND )
>
> SUBDIRS(BasicFilters Common)
>
>
> ADD_EXECUTABLE( PrimMinimumSpanningTree ....some .txx files and .h
> files)
>
> TARGET_LINK_LIBRARIES ( PrimMinimumSpanningTree ITKBasicFilters ITKCommon
> ITKIO)
>
> 3. The CMakeLists.txt file in BasicFilters :
> PROJECT(BasicFilters)
> MESSAGE("ItkGraph BasicFilters")
> ADD_EXECUTABLE(BasicFilters ....some .h and .txx files)
>
> IF(UNIX)
> ADD_DEFINITIONS("-LANG:std")
> ENDIF(UNIX)
> SET_TARGET_PROPERTIES(BasicFilters PROPERTIES LINKER_LANGUAGE CXX)
> TARGET_LINK_LIBRARIES(BasicFilters)
>
> INSTALL_TARGETS(/lib/ BasicFilters)
> INSTALL_FILES(/include/PrimMinimumSpanningTree "\\.h$")
>
>
> 3. The CMakeLists.txt file in Common :
> PROJECT(Common)
> MESSAGE("ItkGraph Common")
> ADD_EXECUTABL(Common ...some .h and .txx files)
>
> IF(UNIX)
> ADD_DEFINITIONS("-LANG:std")
> ENDIF(UNIX)
> SET_TARGET_PROPERTIES(Common PROPERTIES LINKER_LANGUAGE CXX)
> TARGET_LINK_LIBRARIES(Common)
> INSTALL_TARGETS(/lib/ Common)
> INSTALL_FILES(/include/PrimMinimumSpanningTree "\\.h$")
>
>
> Would it be possible for you to tell me where I have gone wrong. Those
> files
> in Common and BasicFilters had not been compiled before.
>
> Sincerely,
>
> Sonali Barua.
>
>
> On 9/18/06, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
>>
>>
>> Hi Sonali,
>>
>> Can you provide your CMakeLists.txt file, as well as your directory
>> structure ?
>> It would be easier to help with that :-)
>>
>> Thanks,
>>
>> Gaetan
>>
>> Le Sun, 17 Sep 2006 22:33:46 +0200, Sonali Barua
>> <barua.sonali at gmail.com>
>> a écrit:
>>
>> > Hello,
>> >
>> > Well I have done that. And there are several folders inside a folder
>> > called
>> > ItkG. I have added the INCLUDE_DIRECTORIES command and also the
>> subdirs
>> > command because there were several sub directories inside it. I also
>> made
>> > the individual CmakeLists.txt file for each of the subdirs inside this
>> > directory. But when I run the cmake . command I get an error that says
>> > that
>> > they cannot recognise the subdirs mentioned. What must I do in order
>> to
>> > make
>> > it recognise my dirs in the Include directories command?
>> >
>> > Sincerely,
>> >
>> > Sonali Barua.
>> >
>> > On 9/17/06, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
>> >>
>> >> Le Sun, 17 Sep 2006 03:20:53 +0200, Sonali Barua
>> >> <barua.sonali at gmail.com>
>> >> a écrit:
>> >>
>> >> > Hello,
>> >> >
>> >> > I am facing a problem in my CMakeLists.txt file. I would like to
>> add
>> >> > several
>> >> > ITK files in a folder that consitutes a library that isn't yet part
>> of
>> >> > the
>> >> > original ITK library using cmake. What are the commands that I have
>> to
>> >> > use
>> >> > so that my source files can use these set of header and .txx files
>> >> while
>> >> > compiling make?
>> >>
>> >> Hi,
>> >>
>> >> The command INCLUDE_DIRECTORIES() should do what you want.
>> >> Please look at http://cmake.org/HTML/Documentation.html or run
>> >>
>> >> cmake --help-command INCLUDE_DIRECTORIES
>> >>
>> >> for a complete description.
>> >>
>> >> Regards,
>> >>
>> >> Gaetan
>> >>
>> >>
>> >>
>> >> --
>> >> Gaëtan Lehmann
>> >> Biologie du Développement et de la Reproduction
>> >> INRA de Jouy-en-Josas (France)
>> >> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
>> >> http://voxel.jouy.inra.fr
>> >>
>>
>>
>>
>> --
>> Gaëtan Lehmann
>> Biologie du Développement et de la Reproduction
>> INRA de Jouy-en-Josas (France)
>> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
>> http://voxel.jouy.inra.fr
>>
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
More information about the Insight-users
mailing list