I have investigated further into this and still have no solution, but a
hint, which anyone may be able to confirm.

It appears like I was led astray by a number of bugs in
target_link_libraries() which I was mistaking for intentional behavior and
so I started to re-create the behavior manually. Which was wrong in the
first place.

So it boils down to the following:

I create an imported lib

add_library(my::imp SHARED IMPORTED GLOBAL)

and import libraries and dlls like so (for all 3 configurations):

set_property(TARGET my::imp APPEND PROPERTY IMPORTED_LOCATION_DEBUG
some_debug.dll)
set_property(TARGET my::imp APPEND PROPERTY INTERFACE_LINK_LIBRARIES_DEBUG
some_debug.lib)

and then link my own target to the imported:

target_link_libraries(mylib PUBLIC myimp)

When I do this without any .lib files being present in there, it will add
an (implicit ?)  link dependency to "my::imp-NOTFOUND.obj" - rather than
nothing at all - which will choke the linker. I have tried all possible
combinations of properties, not using the config specifics, using the
INTERFACE_ prefixed rather than IMPORTED_ prefixed but that doesn't seem to
make much difference. I have however reason to believe that it does work
with at least one lib present. Unfortunately with boost far down as base
dependency I cannot set libs unless risk of interference with boost's
autolink feature. Turning it off and linking myself yielded a different
error.
It then adds something causing the linker to not find ".obj". This is
however invisible in the MSVCs properties dialog. So I rather go with
autolink on, as this at least gives me a visible faulty entry.

Maybe this sheds some light on this. Still hope someone has a hint where I
could look for ways of removing the faulty obj entry.

Thanks,

Stephan
-- 

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