[cmake-developers] Exporting dependent library targets in multiple export sets

Alexander Neundorf neundorf at kde.org
Fri Sep 28 13:21:55 EDT 2012


On Friday 28 September 2012, Brad King wrote:
> On 09/24/2012 08:19 AM, Brad King wrote:
> > On 09/23/2012 01:22 PM, Alexander Neundorf wrote:
> >> This is now in the export-sets-2 branch on stage, including a basic
> >> test.
> >> 
> >> Comments ? Ok to merge into next ?
> > 
> > Yes, thanks.
> 
> This commit is a problem:
> 
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21d1619b
> --------------------------------------------------------------------------
> diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt
> b/Tests/ExportImport/Import/A/CMakeLists.txt index 650af6a..ca7a67a 100644
> --- a/Tests/ExportImport/Import/A/CMakeLists.txt
> +++ b/Tests/ExportImport/Import/A/CMakeLists.txt
> @@ -1,8 +1,9 @@
> +# Import targets from the exported install tree.
> +include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake)
> +
>  # Import targets from the exported build tree.
>  include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake)
> 
> -# Import targets from the exported install tree.
> -include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake)
> 
>  # Try referencing an executable imported from the install tree.
>  add_custom_command(
> --------------------------------------------------------------------------
> 
> The test has no dependence between exports from the build tree and
> exports from the install tree.  The new cross-export dependency
> finding logic is artificially connecting them.
> 
> Export sets created by export() and those created by install()
> should be *independent* groups.  They cannot cross.  It does not
> make sense to have a build tree refer to its own install tree or
> vice versa.

Hmm.
The imported target bld_testExe2lib in ExportBuildTree.cmake links against the 
imported target exp_testExe2libImp created in exp.cmake.

So if exp.cmake is included after ExportBuildTree.cmake this imported library 
does not exist yet.
This sounds like a real dependency to me, not an artificial one.
So changing the order seems to me like the right thing to do.
How should an imported target created via export() behave in your opinion ?

Alex



More information about the cmake-developers mailing list