MantisBT - Community
View Issue Details
0031667Community[OCCT] OCCT:Configurationpublic2020-07-16 12:022020-10-26 22:52
craffael 
bugmaster 
normalfeature 
newopen 
LinuxUbuntu18.04
 
[OCCT] 7.6.0* 
0031667: Configuration, CMake - Dependencies between targets are not specified for static builds and not public
In the CMake buildsystem, the library dependencies of a toolkit target are only registered if BUILD_SHARD_LIBS=On and they are not added to the "public cmake interface" (i.e. the public keyword is missing in target_link_libraries).

I understand that this may be the best option if cmake version 2 is used. But I would say nowadays most users are using Cmake 3 and in Cmake 3 you can declare the dependencies of a cmake library target as public. This has the big advantage, that dependencies are transitively included.

Example: Consider a cmake script which finds occt with find_package(...) and then links to the TKBrep target (with target_link_libraries). Until now this meant, that we also needed to link to TKMath, TKernel, TKG2d, TKG3d and TKGeomBase. With my proposed patch, it suffices to link to TKBrep only. The links to TKMath, TKernel, TKG2d, TKG3d and TKGeomBase are then automatically added thanks to the "PUBLIC" keyword in target_link_libraries.

The proposed patch only adds the public keyword if cmake 3 or higher is used. Otherwise we fallback to the original behavior.
No tags attached.
Issue History
2020-07-16 12:02craffaelNew Issue
2020-07-16 12:02craffaelAssigned To => craffael
2020-07-16 12:11gitNote Added: 0093149
2020-07-16 12:15craffaelAssigned Tocraffael => bugmaster
2020-07-16 13:17kgvProduct Version => 7.4.0
2020-07-16 13:17kgvTarget Version => 7.5.0
2020-07-16 13:17kgvSummaryDependencies between cmake targets are not specified for static builds and not public => Configuration, CMake - Dependencies between targets are not specified for static builds and not public
2020-07-16 13:19kgvSeverityminor => feature
2020-07-16 13:19kgvProduct Version7.4.0 =>
2020-09-11 15:40utverdovTarget Version7.5.0 => 7.6.0*
2020-10-26 22:52craffaelNote Added: 0096285

Notes
(0093149)
git   
2020-07-16 12:11   
Branch CR31667 has been created by craffael.

SHA-1: 61f7249b4c822ef0f9c4a2060feb7d895b04590f


Detailed log of new commits:

Author: craffael
Date: Thu Jul 16 11:12:39 2020 +0200

    31667: target_link_libraries with public interface for cmake >= 3
(0096285)
craffael   
2020-10-26 22:52   
@utverdov may I ask what is the reason that this has been postponed to 7.6.0?