[CMake] header-only project for VS2005

Philip Lowman philip at yhbt.com
Thu Apr 30 08:20:53 EDT 2009


On Wed, Apr 29, 2009 at 2:27 PM, Hicham Mouline <hicham at mouline.org> wrote:

> Hello,
>
> I use cmake to generate a VS2005 solution as well as linux/g++ makefiles.
> I have a directory containing headers only and subdirs also with headers
> only,
> However I wish to display 1 project for that directory, and filters 1 for
> each of the subdirs.
> There is nothing to build for that dir, but I wish to show it in VS2005.
>
> How to do?


Firstly, don't use CMake 2.6.3 for this because it won't work (there is a
bug).  Use 2.6.2 or the latest 2.6.4RC.

set(A_HDRS A/one.h A/two.h A/three.h)
source_group(A FILES ${A_HDRS})
add_executable(HeaderFiles dummy.c ${A_HDRS} EXCLUDE_FROM_ALL)

If that works successfully, you can use the file(GLOB..) command to
determine A_HDRS without listing every header file and then add B_HDRS,
C_HDRS, etc. as needed.

Obviously for dummy.c just use:

int main() { return 0; }

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090430/d57a10c0/attachment.htm>


More information about the CMake mailing list