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

Philip Lowman philip at yhbt.com
Wed May 23 16:13:14 EDT 2007


Pascal Fleury wrote:
> On Sunday 20 May 2007 16:14:49 Kenny Erleben wrote:
> 
>> Our users use their IDE to get an overview of the header library, they
>> do ``code-digging'' and use the class-browser to find their way to a
>> tool etc.. For making this more easy we simply use a ``library'' project
>> in vc80. In terms of CMake I want to write something like:
>>
>> FILE( GLOB_RECURSE OPENTISSUE_HEADER_FILES *.h )
>> ADD_LIBRARY(OpenTissue ${OPENTISSUE_HEADER_FILES})
> 
> ADD_LIBRARY is for a *.lib or *.dll, or *.a/*.so on other platforms, and with 
> only header files it does not know what to do. This is the semantics of this 
> CMake command.

I think INCLUDE_EXTERNAL_MSPROJECT() might be useful in this case if the 
header files aren't changing very often.

Alternatively you could take the pragmatic approach and simply add 
"foo.cc" to ADD_LIBRARY and have it do nothing.

> I don't get clearly either what you are trying to achieve. We typically have 
> the whole project in CVS/SVN, then when checking it our, each user runs 
> cmake. For VS users, they select a directory, and then within that directory 
> you have project files and a solution file. From this, you can use the IDE 
> for searching in the code, it will find the source/headers.

VS won't index header files that aren't in a project.  Often when people 
are linking against external libraries they want these external headers 
to be in a project to get the intellisense completion.

If you're using CMake though you need a way to generate or use these 
"empty" projects because naturally your solution file gets determined by 
CMake.

-- 
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com


More information about the CMake mailing list