[vtkusers] cmake and *.cpp

David Cole david.cole at kitware.com
Tue Dec 6 17:11:04 EST 2005


You can use...
FILE(GLOB MY_FILES model/*.cpp model/*.h)
ADD_EXECUTABLE(MCRecon ${MY_FILES})
...to achieve the effect you're trying for.

FILE GLOB is case sensitive, though. If you are on Windows, make sure 
your files are really named "*.cpp" rather than "*.CPP"...

Lots of folks recommend explicitly listing your source files rather than 
depending on GLOB results (which could pick up garbage if there's 
careless clutter on your disk... :-)).


Hope this helps,
David

Jesse Corrington wrote:

> I am trying to get cmake to create a project without havign to specify 
> every file, and I am trying to use *.cpp and *.h, but it is not 
> working.  Here is what I am trying.  It says unable to find the 
> files.  Is there a different way of doing this.
>
> PROJECT (MCRecon)
>
> INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
> IF (USE_VTK_FILE)
>  INCLUDE(${USE_VTK_FILE})
> ENDIF (USE_VTK_FILE)
>
> ADD_EXECUTABLE(MCRecon model/*.cpp model/*.h)
> TARGET_LINK_LIBRARIES(MCRecon CORE_RL_Magick++_ CORE_RL_MAGICK_)
>
> _________________________________________________________________
> On the road to retirement? Check out MSN Life Events for advice on how 
> to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list