[cmake-developers] RFC: CMake precompiled header support and custom compiler based implementation

Adam Strzelecki ono at java.pl
Sun Mar 1 12:32:26 EST 2015


> An improvement in the API (although maybe not perfect):
> 
>  target_precomplied_header(<target>
>                                          [PREFIX <path/to/prefix_header.h>]
>                                          [FROM
> <other_target_to_share_precomplied_header_with>])
> 
> This way we do not need to specify all the targets to shared the
> precompiled header with at one time and in one call.

You mean we can specify header for multiple targets in one call?

So maybe such one:

	target_precompiled_header(<target> [...]
        	                  <path/to/prefix_header.h>
                	          [REUSE [<target_precomplied_header_is_reuse_from>]]
                        	  [TYPE <shared_header_type>])

I don't like PREFIX word, since this maybe misleading since in other places it means a path prefix. So I would leave it as last non-optional parameter.

I agree SHARED maybe confusing, so maybe we can call it REUSE? And then if they are multiple targets, one may specify REUSE without value, i.e.:

	target_precompiled_header(app lib1 lib2 src/prefix.h REUSE)

Which is equal to:

	target_precompiled_header(app src/prefix.h)
	target_precompiled_header(lib1 src/prefix.h REUSE app)
	target_precompiled_header(lib2 src/prefix.h REUSE app)

WDYT?

-- Adam



More information about the cmake-developers mailing list