Clarify documentation on creating imported targets for Windows shared libraries
I am writing a simple CMake file which is building a shared library. The library depends on 3 other shared libraries so it has to link against those libraries. They are external libraries, i.e. not a target of the CMake. I am having trouble defining this properly. When I do it the way I think I should be doing it, I always get CMake doing links where it is obvious that it has not resolved the library location because it will have modules like "aws-cpp-sdk-core-NOTFOUND" on the link command line. I found a way to get it to work (shown here) but it is platform-dependent (Windows) and doesn't seem like the right solution. Seems like I am missing something basic -- can someone help?
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
PROJECT(ICOSProvider)
INCLUDE_DIRECTORIES($ENV{AWS_SRC_DIR}/aws-cpp-sdk-core/include $ENV{AWS_SRC_DIR}/aws-cpp-sdk-s3/include $ENV{NOTESINC})
ADD_LIBRARY(ICOSProvider SHARED ICOSProvider.cpp)
# This project requires the AWS core and S3 libraries.
#ADD_LIBRARY(aws-cpp-sdk-core SHARED IMPORTED)
#SET_PROPERTY(TARGET aws-cpp-sdk-core PROPERTY IMPORTED_LOCATION $ENV{AWS_BIN_DIR}/aws-cpp-sdk-core)
#ADD_LIBRARY(aws-cpp-sdk-s3 SHARED IMPORTED)
#SET_PROPERTY(TARGET aws-cpp-sdk-s3 PROPERTY IMPORTED_LOCATION $ENV{AWS_BIN_DIR}/aws-cpp-sdk-s3)
#ADD_LIBRARY(nnotes SHARED IMPORTED)
#SET_PROPERTY(TARGET nnotes PROPERTY IMPORTED_LOCATION $ENV{NOTESLIB})
#TARGET_LINK_LIBRARIES(ICOSProvider aws-cpp-sdk-core aws-cpp-sdk-s3 nnotes)
#
# This works by itself, but doesn't seem to be the right way to do things. I've tried various stuff including the
# statements commented out immediately above, but can't get it quite right.
#
TARGET_LINK_LIBRARIES(ICOSProvider $ENV{AWS_BIN_DIR}/aws-cpp-sdk-core/Debug/aws-cpp-sdk-core.lib $ENV{AWS_BIN_DIR}/aws-cpp-sdk-s3/Debug/aws-cpp-sdk-s3.lib $ENV{NOTESLIB}/nnotes.lib)