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) link 
it to that library
- Create an executable
- Link the executable to the shared library, thus creating a transitive 
conditional 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 from
  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 
testexe, usage requirements only)
TargetPropertyNode::Evaluate(testso, INTERFACE_SOURCES)
GeneratorExpressionContent 
($<TARGET_PROPERTY:testso,INTERFACE_SOURCES>)::Evaluate()
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üken
Spezialist Entwicklung
Moosacher Straße 86
80809 München

Tel.:  +49 89 189311-35
Fax:  +49 89 189311-20
Mail: daniel.lue...@bmw-carit.de
Web: http://www.bmw-carit.de
-------------------------------------------------------------------------
BMW Car IT GmbH
Geschäftsführer: Michael Würtenberger und Alexis Trolin
Sitz und Registergericht: München 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 
information 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/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to