[CMake] Header only targets, solution folders and shared settings?

Eric Noulard eric.noulard at gmail.com
Sun May 20 09:45:52 EDT 2007


2007/5/20, Kenny Erleben <kenny at diku.dk>:
> Hi,
>
> I am trying to convert the OpenTissue open source project
> (www.opentissue.org) to CMake. I got four problems that I do not know
> how to deal with:
>
> i) How to create a header only target(no source files at all)  in CMake
> just for class browsing?

Dont really know what you want?

May be you can just use the CMake
INSTALL command to install your header?

May be you could explain what you want CMake to do with the file?
Why do you want the header to be a "target"?

> ii) How to collect projects into solution folders as in visual studio 8.0?

Don't know. My usage of CMake for windows/visual is more simple than that.

> iii) How to make several executables share the same compiler- and
> linker- flags?

you may define a CMake variable
SET(MYCFLAGS "jkdlfjlj")
SET(MYLDFLAGS "ljjl")

then you may use
SET_TARGET_PROPERTIES(target1 target2
                                           PROPERTIES
                                           COMPILE_FLAGS ${MYCFLAGS}
                                           LINK_FLAGS ${MYLDFLAGS})


> iv) How to make several executables share the same TARGET_LINK_LIBRARIES
> settings?

You may define another var

SET(WHATEVER_LIBS lib1 lib2 lib3)

then
TARGET_LINK_LIBRARIES(target1 ${WHATEVER_LIBS})
TARGET_LINK_LIBRARIES(target2 ${WHATEVER_LIBS})
...

> Could anybody please help me?

Those answers may not be the "definitive" good ones but I hope
they will help you.

-- 
Erk


More information about the CMake mailing list