[CMake] How to set subdir in CMakeListes.txt?

William A. Hoffman billlist at nycap.rr.com
Thu Dec 22 10:58:42 EST 2005


At 12:50 PM 12/21/2005, Chunyan Jiang wrote:
>Dear all,
>
>I want to build one project by using fltk, itk, vtk under visual
>studio 6. I use CMake 2.2 to configer my files. I want to organize my
>files in some sub folders, such as UIFiles, ProcessFiles.
>
>I put my .fl in the sub folder of the project. But when I build the
>project, the generated source .cxx and .h of .fl are not in sub folder
>as .fl, but in project folder.
>
>Furthermore, I get the following warning message:
>In CMake 2.2 the FLTK_WRAP_UI command sets a variable to the list of
>source files that should be added to your executable or library. It
>appears that you have not added these source files to your target. You
>should change your CMakeLists.txt file to directly add the generated
>files to the target...

For this, you need to follow the instructions as given.

FLTK_WRAP_UI(MyProject ${APPLICATION_FLUIDS}) will create a variable called
MyProject_FLTK_UI_SRCS, you need to reference that variable in the call
to ADD_EXECUTABLE.  All generated files are put into the build directory.
I would recommend that you use "out of source" builds for cmake.  It is very
simple, just specify a different path to your source and binary directories.

ADD_EXECUTABLE(foo ${MyProject_FLTK_UI_SRCS})

-Bill



More information about the CMake mailing list