[CMake] SOURCE_GROUPS

Manuel Klimek klimek at box4.net
Wed May 17 06:44:17 EDT 2006


Hi there,

I've got a problem with SOURCE_GROUPS with cmake 2.4.1 in windows (VC 2005).
I already found out that if I want to add headers in a source
group I'll have to add the headers to the ADD_LIBRARY or ADD_EXECUTABLE.
But I have the problem that I include platform specific .cpp files
in another .cpp file and I want to add those files to the source list.
I don't know how I can make them show up in the source group without
compiling the file:
# x.cpp includes x_inc.cpp
SET( x_SRC x.cpp )
SET( x_HDR x.h )
SET( x_INC x_inc.cpp )
SOURCE_GROUP( "X Sources" ${x_SRC} ${x_INC} )
SOURCE_GROUP( "X Headers" ${x_HDR} )
ADD_LIBRARY( x STATIC ${x_SRC} ${x_HDR} ${x_INC} )

now it tries to compile x_inc.cpp which doesn't work
because it only compiles when included in x.cpp

I already tried:
SET_SOURCE_FILES_PROPERTIES( x_inc.cpp HEADER_FILE_ONLY 1 )
but that didn't change anything

if I do simply
ADD_LIBRARY( x STATIC ${x_SRC} ${x_HDR} )
the x_inc.cpp doesn't show up at all ...

I though about somehow adding a dependency from library x to
x_inc.cpp but couldn't find out how to do this either...

any help would be appreciated,
Manuel




More information about the CMake mailing list