[CMake] cannot include txx files using CMake

Prathamesh Kulkarni prathameshmkulkarni at gmail.com
Wed Oct 20 16:29:40 EDT 2010


Thanks Michael. I had not included the ${OCTCommon_SOURCE_DIR}/src using
INCLUDE_DIRECTORIES.

- Prathamesh

On 10/20/2010 07:55 PM, Prathamesh Kulkarni wrote:
> I do not understand why I am having errors for only .txx files and not for
> .cpp files placed in the same common folder. Any help would be highly
> appreciated. Right now, I am forced to paste common the files in all the
> project folders where ever they are required.

Does ${OCTCommon_SOURCE_DIR}/src appear in the include path, i.e. have
you said INCLUDE_DIRECTORIES(${OCTCommon_SOURCE_DIR}/src) and have you
said it at the right place? How do the #include directives for the txx
files look like? Do they involve subdirectories, e.g. do they possibly
read "#include <src/itkImageToVTKImageFilter.txx>"? Could you post the
complete compile line which fails due to that missing include file?

Regards,

Michael

> On Wed, Oct 20, 2010 at 12:13 PM, Prathamesh Kulkarni <
> prathameshmkulkarni at gmail.com> wrote:
>
>> Thanks, I tried getting rid of the GLOB. But I am still getting the same
>> error as earlier:
>>
>>  fatal error C1083: Cannot open include file:
>> 'itkImageToVTKImageFilter.txx': No such file or directory
>>
>> (This file is present in a common directory)
>>
>> The CMakeLists now looks like this:
>>
>>
>> SET(IMPORTED_SRCS
>>  ${OCTIO_SOURCE_DIR}/src/OCTBScan.cpp
>>  ${OCTIO_SOURCE_DIR}/src/OCTCScan.cpp
>>  ${OCTIO_SOURCE_DIR}/src/OCTBScanHeader.cpp
>>  ${OCTIO_SOURCE_DIR}/src/OCTCScanHeader.cpp
>>  ${OCTCommon_SOURCE_DIR}/src/OCTCommon.cpp
>>  ${OCTCommon_SOURCE_DIR}/src/itkImageToVTKImageFilter.txx
>>  ${OCTCommon_SOURCE_DIR}/src/itkVTKImageToImageFilter.txx
>>  )
>>
>> SET(IMPORTED_HDRS
>>  ${OCTIO_SOURCE_DIR}/include/OCTBScan.h
>>  ${OCTIO_SOURCE_DIR}/include/OCTCScan.h
>>  ${OCTIO_SOURCE_DIR}/include/OCTBScanHeader.h
>>  ${OCTIO_SOURCE_DIR}/include/OCTCScanHeader.h
>>  ${OCTCommon_SOURCE_DIR}/include/OCTCommon.h
>>  ${OCTCommon_SOURCE_DIR}/include/itkImageToVTKImageFilter.h
>>  ${OCTCommon_SOURCE_DIR}/include/itkVTKImageToImageFilter.h
>>  )
>>
>>
>> #FILE(GLOB SRCS "src/*.cpp" "src/*.c" "src/*.txx" ${IMPORTED_SRCS})
>> #${IMPORTED_SRCS1})
>> #FILE(GLOB HDRS "include/*.h" ${IMPORTED_HDRS}) #${IMPORTED_HDRS1})
>>
>> SET(SRCS
>>  ./src/OCTBScanVisualization.cpp
>>  ./src/OCTCScanVisualization.cpp
>>  ./src/OCTVisualization_main.cpp
>>  #${IMPORTED_SRCS}
>> )
>>
>> SET(HDRS
>>  ./include/OCTBScanVisualization.h
>>  ./include/OCTCScanVisualization.h
>>  #${IMPORTED_HDRS}
>>  )
>>
>>
>> ADD_EXECUTABLE(OCTVisualization ${SRCS} ${HDRS} ${IMPORTED_SRCS}
>> ${IMPORTED_HDRS})
>>
>>
>> What am I doing wrong here?
>>
>> - Prathamesh
>>
>>
>> On Wed, Oct 20, 2010 at 11:26 AM, John Drescher <drescherjm at gmail.com
>wrote:
>>
>>> On Wed, Oct 20, 2010 at 12:19 PM, Prathamesh Kulkarni
>>> <prathameshmkulkarni at gmail.com> wrote:
>>>> Okay, could you please suggest an alternative over this issue?
>>>>
>>>
>>> I add each file one by one in variables. The following is from an app
>>> used for unit testing my Qt SQLITE database for my current
>>> application.
>>>
>>> SET( DEMO_SRCS
>>>        ./src/main.cxx
>>>        ./src/MainWindow.cxx
>>>        ./src/CmdCreateDB.cxx
>>>        ./src/CmdAddUser.cxx
>>>        ./src/CmdAddStudy.cxx
>>>        ./src/CmdAddCase.cxx
>>>        ./src/CmdAddImage.cxx
>>>        ./src/CmdAddCaseAltID.cxx
>>>        #./src/CmdAddCaseLocation.cxx
>>>        ./src/CmdAddImageSeries.cxx
>>>        ./src/CmdAddStudyMode.cxx
>>>        ./src/CmdAddSRSMPart.cxx
>>>        ./src/CmdAddSRSMCasePart.cxx
>>>        #./src/CmdAddStudySMPart.cxx
>>>        ./src/CmdUpdateRSSSMCompletion.cxx
>>>        ./src/CmdSetCurrentReaderStudyMode.cxx
>>>        ./src/CmdGetStudyModeReaderParticipation.cxx
>>>        ./src/CmdGetReaderTotalCaseCount.cxx
>>>        ./src/CmdGetReaderTotalCaseList.cxx
>>>        ./src/CmdGetReaderCompletedCaseCount.cxx
>>>        ./src/CmdGetReaderCompletedCaseList.cxx
>>>        ./src/CmdGetReaderRecentCaseCount.cxx
>>>        ./src/CmdGetReaderRecentCaseList.cxx
>>>        ./src/CmdCounterBalanceStudyModes.cxx
>>>        ./src/CmdUpdateAdmin.cxx
>>>        ./src/CmdLstReadersInStudy.cxx
>>>        ./src/CmdAddReaderStudyModeCompletion.cxx
>>>        ./src/CmdAddReaderCaseCompletion.cxx
>>>        ./src/CmdTestImageSeriesCosines.cxx
>>>        ./src/CmdVerifyDB.cxx
>>> )
>>>
>>> SET( DEMO_HDRS
>>>        ./Include/CmdCreateDB.h
>>>        ./Include/CmdAddUser.h
>>>        ./Include/CmdAddStudy.h
>>>        ./Include/CmdAddCase.h
>>>        ./Include/CmdAddImage.h
>>>        ./Include/CmdAddCaseAltID.h
>>> #       ./Include/CmdAddCaseLocation.h
>>>        ./Include/CmdAddImageSeries.h
>>>        ./Include/CmdAddStudyMode.h
>>>        ./Include/CmdAddSRSMPart.h
>>>        #./Include/CmdAddStudySMPart.h
>>>        ./Include/CmdAddSRSMCasePart.h
>>>        ./Include/CmdUpdateRSSSMCompletion.h
>>>        ./Include/CmdSetCurrentReaderStudyMode.h
>>>        ./Include/CmdGetStudyModeReaderParticipation.h
>>>        ./Include/CmdGetReaderTotalCaseCount.h
>>>        ./Include/CmdGetReaderTotalCaseList.h
>>>        ./Include/CmdGetReaderCompletedCaseCount.h
>>>        ./Include/CmdGetReaderCompletedCaseList.h
>>>        ./Include/CmdGetReaderRecentCaseCount.h
>>>        ./Include/CmdGetReaderRecentCaseList.h
>>>        ./Include/CmdCounterBalanceStudyModes.h
>>>        ./Include/CmdUpdateAdmin.h
>>>        ./Include/CmdLstReadersInStudy.h
>>>        ./Include/CmdAddReaderStudyModeCompletion.h
>>>        ./Include/CmdAddReaderCaseCompletion.h
>>>        ./Include/CmdTestImageSeriesCosines.h
>>>        ./Include/CmdVerifyDB.h
>>> )
>>>
>>> SET( DEMO_MOC_HDRS
>>>        ./Include/MainWindow.h
>>> )
>>>
>>> # some .ui files
>>> SET( DEMO_UIS
>>> )
>>>
>>> # and finally an resource file
>>> SET( DEMO_RCS
>>>
>>> )
>>>
>>> # this command will generate rules that will run rcc on all files from
>>> DEMO_RCS
>>> # in result DEMO_RC_SRCS variable will contain paths to files produced
by
>>> rcc
>>> QT4_ADD_RESOURCES( DEMO_RC_SRCS ${DEMO_RCS} )
>>>
>>> # and finally this will run moc:
>>> QT4_WRAP_CPP( DEMO_MOC_SRCS ${DEMO_MOC_HDRS} )
>>>
>>> # this will run uic on .ui files:
>>> QT4_WRAP_UI( DEMO_UI_HDRS ${DEMO_UIS} )
>>>
>>> add_executable(dbDev0 ${DEMO_SRCS}
>>>    ${DEMO_MOC_SRCS}
>>>        ${DEMO_HDRS}
>>>        ${DEMO_MOC_HDRS}
>>>        ${DEMO_UI_HDRS}
>>>        ${DEMO_RC_SRCS}
>>> )
>>>
>>> target_link_libraries(dbDev0
>>>        ${QT_LIBRARIES}
>>>        ${UPMC_EXTERNAL_LIBS}
>>> )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101020/511a55df/attachment.htm>


More information about the CMake mailing list