[CMake] Question regarding project structure

David Aldrich David.Aldrich at EU.NEC.COM
Thu Sep 16 11:13:18 EDT 2010


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



More information about the CMake mailing list