[Cmake] SOURCE_FILES default extension

Lorensen, William E (CRD) lorensen at crd.ge.com
Tue Jan 22 13:49:28 EST 2002


How does cmake find the extension to use in the SOURCE_FILES statement?

I just had an example that used VTK and ITK. My SOURCE_FILES line looked like this
SOURCE_FILES(Distance_SRCS
Distance
Options
)

The first time cmake generated the Makefile, it correctly guessed the extension as "cxx". I
successfully built the program (called Distance). Then I edited the source file and did another
gmake. cmake generated a new Makefile with the compile line using the executable name rather than the
.cxx file.
Seems that the second time, it found that the file listed in the SOURCE_FILES was there (the
executable this time) and messed up my Makefile. If I remove the Distance file and rerun cmake, it
generates the correct Makefile.

To fix the problem, I changed my command to:

SOURCE_FILES(Distance_SRCS
Distance.cxx
Options.cxx
)

and all was fine.

Seems that cmake should REQUIRE an extension on these source files.

Bill





More information about the CMake mailing list