[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Erroneous CMP0022 warning for transitive conditional link dependencies?
From:       Daniel Lueken <Daniel.Lueken () bmw-carit ! de>
Date:       2016-08-25 16:06:51
Message-ID: 3cdd17902c1249449330ca6acd40331b () CIT-HM8-EX01 ! bmw-carit ! intra
[Download RAW message or body]

Hi all,

As it seems you get an erroneous CMP0022 warning in the following scenario,=
 due to a generator expression not being resolved before string comparison.
Confirmed with versions 3.5.1 and rev 00a583ac6833 . (2016-08-24 06:01:04) =
on Ubuntu Xenial using the Unix Makefile generator.

- Create a library
- Create a shared library and publicly conditionally (optimized | debug) li=
nk it to that library
- Create an executable
- Link the executable to the shared library, thus creating a transitive con=
ditional dependency on the first library

Running CMake on this setup yields the following warning during generation:

---------------------------------------------------------------------------=
-----------------------------

> ./cmake .
.
CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "testso" has an INTERFACE_LINK_LIBRARIES property which differs fr=
om
  its LINK_INTERFACE_LIBRARIES properties.

  INTERFACE_LINK_LIBRARIES:

    $<$<NOT:$<CONFIG:DEBUG>>:testlib>

  LINK_INTERFACE_LIBRARIES:

    testlib

---------------------------------------------------------------------------=
-----------------------------

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

project(libtest_project)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_library(testlib STATIC testlib.cpp)

add_library(testso SHARED sharedlib.cpp)

target_link_libraries(testso PUBLIC optimized testlib)

add_executable(testexe exe.cpp)

target_link_libraries(testexe testso)

---------------------------------------------------------------------------=
-----------------------------

Simplified stack trace:
cmGeneratorTarget (Target: testso)::GetLinkInterfaceLibraries("", target te=
stexe, usage requirements only)
TargetPropertyNode::Evaluate(testso, INTERFACE_SOURCES)
GeneratorExpressionContent ($<TARGET_PROPERTY:testso,INTERFACE_SOURCES>)::E=
valuate()
cmCompiledGeneratorExpression ($<TARGET_PROPERTY:testso,INTERFACE_SOURCES>)=
::EvaluateWithContext()
cmCompiledGeneratorExpression ($<TARGET_PROPERTY:testso,INTERFACE_SOURCES>)=
::Evaluate()
processSources()
cmGeneratorTarget (Target: testexe)::GetSourceFiles(config: "")
cmGeneratorTarget (Target: testexe)::GetSourceFiles(config: "")
cmTargetTraceDependencies (Target: textexe)::ctor()
cmGeneratorTarget (Target: testexe)::TraceDependencies()
cmLocalGenerator (/src)::TraceDependencies()
cmGlobalGenerator::Compute()
cmake::Generate()
cmake::Run()
main()

---------------------------------------------------------------------------=
-----------------------------

.or is this intended behavior?

Best regards

-- =

BMW Car IT GmbH
Daniel L=FCken
Spezialist Entwicklung
Moosacher Stra=DFe 86
80809 M=FCnchen

Tel.:=A0 +49 89 189311-35
Fax:=A0 +49 89 189311-20
Mail: daniel.lueken@bmw-carit.de
Web: http://www.bmw-carit.de
-------------------------------------------------------------------------
BMW Car IT GmbH
Gesch=E4ftsf=FChrer: Michael W=FCrtenberger und Alexis Trolin
Sitz und Registergericht: M=FCnchen HRB 134810
-------------------------------------------------------------------------


-- =


Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.=
org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more in=
formation on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensour=
ce/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic