[CMake] [newbie] Do I have to list all .cpp files explicitly?

Eric Noulard eric.noulard at gmail.com
Fri Nov 17 12:37:57 EST 2006


2006/11/17, Harlan Wood <hwood at wgen.net>:
>
>
> Hi,
>
> I'm hoping to find a tool that, given a top-level C++ file, will find and
> compile and its dependencies (including headers and source files).  I'm
> brand new to CMake and wondering if I have to list all .cpp files
> explicitly?

You should specify ALL sources files to CMake

>
> I have simplified the CMake "hello world" example to demonstrate what I
> want:  I have a "main" class which includes "hello.h" -- is there a way to
> suggest to CMake that it look for hello.cpp in the same location?

but you may use FILE(GLOB SRCFILES <glob expr>) to "generate" source file list.

try

FILE(GLOB SRCFILES *.cxx)
ADD_EXECUTABLE(helloDemo $(SRCFILES))

You may fast-read the CMake documentation too :))
Here, http://www.cmake.org/HTML/Documentation.html

A fast read may gives you a idea of what's possible to do.
Then you may come back later for time to time thorough reading
of each CMake macro when you need them.

-- 
Erk


More information about the CMake mailing list