[cmake-developers] Depends information in buildsystem files

Stephen Kelly steveire at gmail.com
Mon Feb 11 14:38:12 EST 2013


Brad King wrote:

> 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.

How would that be done in 'full project' mode? The best we can do is 
generate a file with the imported targets (my branch already does that 
much), and allow the user to include() it, right? And we'd generate that 
file directly in the binary_dir the user specified in the try_compile call? 
And the file would be called something generic so that the user does this?

 include("${CMAKE_CURRENT_BINARY_DIR}/tryCompileTargets.cmake")

in their own 'full project' code?

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

I think in the single-source-file mode, we do know what to do with them.

> 
> 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.  

So, we'll have 

 try_compile(TCRESULT 
   "${CMAKE_CURRENT_BINARY_DIR}/tcresultbindir"
   "tcresult_src.cpp"
   TARGETS foo bar
   LINK_LIBRARIES foo bar
 )

? 

> They would replace the current
> -D convention which pre-dated keyword arguments in CMake. 

I see more policies coming :). This is future work anyway.

> The outer
> try_compile call would handle target exports for LINK_LIBRARIES.
> 

What do you mean 'outer'?

Thanks,

Steve.





More information about the cmake-developers mailing list