I am trying to convert a Visual Studio 2013 project that I have over to use CMake, but am running into issues when I include a source header file that uses some shared libraries. In my original VS project properties under Common Properties > References I have added several references I need in my project. There are options like a relative path to the library, some build settings and and so on. The XML generated in my VS project file looks very similar to the following:
<Project>
.
.
.
<ItemGroup>
<Reference Include="MyLib">
<HintPath>../lib/MyLib.dll</HintPath>
</Reference>
<Reference Include="System">
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</Reference>
.
.
.
</ItemGroup>
Basically I want to be able to use 'MyLib.dll', 'System', and my other references, but I don't know how to include them via CMake.
I did some Googling and found this: CMake link to external library, but that didn't seem to work. Any ideas what commands I need to use to use the shared libraries?
EDIT:
A minimal version of my current CMakeLists.txt file
cmake_minimum_required(VERSION 3.0.2)
project(MyProject)
set(EXE_NAME "MyExe")
set(SOURCES
"src/main.cpp"
"src/SourceUsingDLL.cpp"
"src/others.cpp"
)
set(HEADERS
"include/HeaderUsingDLL.h"
"include/otherHeaders.h"
)
include_directories(include)
add_executable(${EXE_NAME} ${SOURCES} ${HEADERS})
### What I tried - Didn't work ####
add_library( mylib SHARED IMPORTED )
set_target_properties( mylib PROPERTIES IMPORTED_LOCATION pathToDLL )
target_link_libraries(${EXE_NAME} mylib)
For the dll path I used both relative and absolute for my local dll, but I don't what what I would do for the System reference.