[CMake] Question regarding project structure

Michael Wild themiwi at gmail.com
Thu Sep 16 11:40:23 EDT 2010


On 16. Sep, 2010, at 17:35 , David Cole wrote:

> On Thu, Sep 16, 2010 at 11:33 AM, Michael Wild <themiwi at gmail.com> wrote:
> 
>> 
>> On 16. Sep, 2010, at 17:13 , David Aldrich wrote:
>> 
>>> Hi David
>>> 
>>>> Something like this should work:
>>> 
>>>> cmake_minimum_required(VERSION 2.8)
>>>> project(MyExe)
>>> 
>>>> add_subdirectory(../Kernel Kernel)
>>>> add_subdirectory(../DynLibs DynLibs)
>>> 
>>>> add_executable(MyExe exe.cxx)
>>>> target_link_libraries(MyExe Kernel)
>>> 
>>> I have a problem with add_executable(). Our Kernel library includes
>> main.cpp, so all our existing linker command does is to take libKernel.a and
>> make it an executable:
>>> 
>>> g++ -o _gnuRelease/MyExe -ldl -Wl,-whole-archive,-export-dynamic
>> ../Kernel/_gnuRelease/libKernel.a
>>> 
>>> So I have no source files to specify. Does 'exe.cxx' (above) have special
>> properties or is it just a placeholder? If the latter, how can I build an
>> executable with no source files specified?
>>> 
>>> BR
>>> 
>>> David
>> 
>> There is none. The only way to do that is create an empty dummy file (using
>> e.g. a combination of file(WRITE) and configure_file() to prevent
>> recompiling after every CMake run).
>> 
>> --
>> There is always a well-known solution to every human problem -- neat,
>> plausible, and wrong.
>> H. L. Mencken
>> 
>> 
> Or you could just add an empty source file to your source tree...


True, but some people hate that; We've had this discussion already on this list where somebody seemed to be honestly offended by the mere notion of an empty dummy file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100916/a7b13542/attachment-0001.pgp>


More information about the CMake mailing list