[CMake] Are header-only targets supported?
Pedro d'Aquino
budsbd at gmail.com
Wed Nov 3 12:55:33 EDT 2010
Hi everyone,
On Mon, Nov 1, 2010 at 11:24 AM, David Cole <david.cole at kitware.com> wrote:
> You could use a block like this:
>
> if(CMAKE_GENERATOR STREQUAL "Xcode")
> ...
> endif()
>
Yes, that does work. The only problem is it doesn't scale very well;
at the moment I use MSVC and Xcode so I need to add two clauses. If I
start using another IDE in the future I'll have to update the
CMakeLists.txt as well.
On Mon, Nov 1, 2010 at 11:58 AM, <Aaron_Wright at selinc.com> wrote:
> I have a couple projects like that in my build. I just make a "dumby.cpp"
> file that is completely empty and give that to add_library() with the
> other headers. It seems to make everyone happy.
As described in my original post, this generates some ugly warnings
about the library having no symbols (at least on my version of gcc).
On Mon, Nov 1, 2010 at 4:12 PM, Ryan Pavlik <rpavlik at iastate.edu> wrote:
> I've also done something like this:
> set(SOURCES
> LockFreeBuffer.h
> Saturate.h
> Stride.h)
>
> add_custom_target(UtilityHeaders SOURCES ${SOURCES})
That's just what I was looking for, thanks! Now the project appears in
both Xcode and MSVC, and make still runs fine.
Cheers,
Pedro
More information about the CMake
mailing list