[Cmake] Can source be elsewhere?

Andy Cedilnik andy.cedilnik at kitware.com
Wed Feb 5 08:22:49 EST 2003


Hi John,

Here is what you can do:

PROJECT(SOMETHING)
SET(SOMETHING_SRCS something.cpp another.cpp)
SET(SOURCE_DIRECTORIES /some/path/source)

SET(REAL_SRCS)
FOREACH(file ${SOMETHING_SRCS)
  SET(REAL_SRCS ${REAL_SRCS} "${SOURCE_DIRECTORIES}/${SOMETHING_SRCS}")
ENDFOREACH(file)

INCLUDE_DIRECTORIES(/some/path/include)
ADD_EXECUTABLE(something ${REAL_SRCS} )

			Andy

> On Wed, 2003-02-05 at 05:08, John Fletcher wrote:
> I am new to CMake and trying out some ideas.
> 
> I have a lot of existing source files.  I had the idea of setting up 
> projects for CMake in new directories and pulling in source files 
> from elsewhere.
> 
> e.g. 
> 
> PROJECT(SOMETHING)
> SET(SOMETHING_SRCS something.cpp another.cpp)
> SOURCE_DIRECTORIES(/some/path/source)
> INCLUDE_DIRECTORIES(/some/path/include)
> ADD_EXECUTABLE(something ${SOMETHING_SRCS} )
> 
> 
> I can do all of this except the source directories.  Am I missing 
> something? I end up copying the sources into the project directory.





More information about the CMake mailing list