The plugin has to call functions in an external dependent dll file. I followed the tutorial and did the following but still no success.
I have pasted a sample.dll file at my project root.
I have added the following configuration to projectDef.cmake (projects\plugintest\Win\projectDef.cmake):
set (LIBRARY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/sample.dll")
target_link_libraries(${PROJECT_NAME} debug "${LIBRARY_PATH}/debug/sample.dll")
target_link_libraries(${PROJECT_NAME} optimized "${SANDSTONE_DIR}/release/sample.dll")
I generated the solution file using "firebreath\prep2010.cmd projects build"
I added the following in PluginTestAPI.cpp:
include "sample.h"
Build errors:
Cannot open include file "sample.h" : No such file or directory.
The dll file is a package of header file and lib file. I am able to successfully make calls to the dll using JNA.
I am a Java developer and don't have much experience in C++ programming. I believe I am missing something fundamental.
Thanks!
The main thing you need to understand that you're missing here is that you don't actually link to a DLL; instead, you link to the .lib file that goes with the DLL and that will do the loading of the DLL for you behind the scenes. Wherever you're building your dependent dll you'll find that there is also a .lib file; specify that as the link target in target_link_libraries.
Next if you want it to open include file "sample.h" you'll need to add the path to sample.h to your include directories using the cmake include_directories command.
I suspect it's a typo, but you have also specified sample.dll twice; once in LIBRARY_PATH, and then once in your target_link_libraries call. That's not going to work, since it'll cause it to try to link to ${CMAKE_CURRENT_SOURCE_DIR}/sample.dll/debug/sample.dll
When all else fails open up the project properties in visual studio (since that's what you're using) and look at what libraries and include directories there are; that will often help you understand what cmake is actually doing.
Hope that helps!