Hello,

Until recently, I was making use of the 'debug' and 'optimized' keywords to 
select the config-specific versions of external dependencies to link in, i.e. 
if I wanted to link Bar into Foo, I would use:

target_link_libraries (Foo DEBUG ${Bar_Debug} OPTIMIZED ${Bar_Release})

Now I have added my own custom configuration to CMAKE_CONFIGURATION_TYPES, 
let's call it "Custom", and I want Foo, when built in Custom config, to link 
against the Custom variant of Bar. I did some reading and came across IMPORTED 
targets, which seem designed for this purpose, so I added new lines like the 
following:

add_library (Bar STATIC IMPORTED GLOBAL)
set_property (TARGET Bar PROPERTY IMPORTED_LOCATION_DEBUG 
"/path/to/Debug/Bar.lib")
set_property (TARGET Bar PROPERTY IMPORTED_LOCATION_RELEASE 
"/path/to/Release/Bar.lib")
set_property (TARGET Bar PROPERTY IMPORTED_LOCATION_CUSTOM 
"/path/to/Custom/Bar.lib")
target_link_libraries (Foo Bar)

However, when I open the generated Visual Studio project, I see "Bar-NOTFOUND" 
in the linker inputs. If I add the line:

set_property (TARGET Bar PROPERTY IMPORTED_LOCATION "/path/to/Release/Bar.lib")

Then the linker inputs are resolved correctly, but of course all of my 
configurations of Foo are now going to link against the same Release 
configuration of Bar.

Is this a bug, or am I simply not using this feature correctly? I tried both 
3.0.1 and 3.1rc2 on Windows.

Thanks,

Parag Chandra

-- 

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