[cmake-developers] Depends information in buildsystem files

Brad King brad.king at kitware.com
Mon Feb 11 14:26:19 EST 2013


On 02/11/2013 02:18 PM, Stephen Kelly wrote:
> Would cmCoreTryCompile also generate a target_link_libraries line for the 
> targets after the existing target_link_libraries line?
> 
> Otherwise using the raw try_compile would not do what you expect:

I wouldn't expect TARGETS to be linked.

>  try_compile( ... TARGETS foo ...)
>  # Generates an imported target for foo, but does not link to it.
> 
> What effect would the TARGETS parameter have in 'full project' mode?

In both cases I'm picturing that TARGETS will merely make the targets
available in the test project.  It doesn't do anything with them.

Especially in the case of a full project we wouldn't know what to do
with them anyway.

For the single-source signature I could see adding a bunch of modern
keyword arguments like INCLUDE_DIRECTORIES, LINK_LIBRARIES, etc.
that essentially turn into the corresponding properties on the
generated project's test target.  They would replace the current
-D convention which pre-dated keyword arguments in CMake.  The outer
try_compile call would handle target exports for LINK_LIBRARIES.

-Brad



More information about the cmake-developers mailing list