[CMake] Having problems getting started
blinkeye
gentoo at blinkeye.ch
Sun Mar 2 05:17:19 EST 2008
I guess the following would suit your needs too:
# AUX_SOURCE_DIRECTORY: Find all source files in a directory.
AUX_SOURCE_DIRECTORY(dir VARIABLE)
Collects the names of all the source files in the specified directory
and stores the list in the variable provided. This command is intended
to be used by projects that use explicit template instantiation.
Template instantiation files can be stored in a "Templates" subdirectory
and collected automatically using this command to avoid manually listing
all instantiations.
It is tempting to use this command to avoid writing the list of source
files for a library or executable target. While this seems to work,
there is no way for CMake to generate a build system that knows when a
new source file has been added. Normally the generated build system
knows when it needs to rerun CMake because the CMakeLists.txt file is
modified to add a new source. When the source is just added to the
directory without modifying this file, one would have to manually rerun
CMake to generate a build system incorporating the new file.
On 02/29/2008 07:47 PM, Arlen Cox wrote:
> Thanks Mike.
> That was exactly what I was looking for.
>
> -Arlen
>
> On Fri, Feb 29, 2008 at 11:20 AM, Mike Jackson <imikejackson at gmail.com>
> wrote:
>
>> You may want to look at the
>> file(GLOB variable [RELATIVE path] [globbing expressions]...)
>>
>> or
>>
>> file(GLOB_RECURSE variable [RELATIVE path]
>> [globbing expressions]...)
>>
>> if you do a cmake --help-command file a print out of the documentation
>> for that command will be listed.
>>
>> Also,
>> Some projects use the following as the way to get source files:
>>
>> SET (MyProject_SRCS SomeFile.cpp SomeOtherFile.cxx lib/SomeLibFile.cpp
>> )
>>
>> ADD_LIBRARY(VSEngine ${MyProject_SRCS})
>>
>> That will default to a static library. If you want a shared library:
>>
>> ADD_LIBRARY(VSEngine SHARED ${MyProject_SRCS})
>>
>>
>> --
>> Mike Jackson
>>
>>
>> On Feb 29, 2008, at 11:37 AM, Arlen Cox wrote:
>>
>> 1. Is there some way to use wildcards when specifying files for a
>> library? Something like this:
>> add_library(VSEngine *.cpp)
>>
>> That particular line doesn't work. I tried, but there must be a way that
>> I can add a file to a project without having to modify the makefil
>>
>>
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list