CMake link to shared library on windows: the error is that the .lib file cannot be found

I have a library definition in CMake that creates a shared library of a small set of files, and I have it compiling just fine for both Linux and Windows.

However, I also have another library that references the shared library, and it works fine on Linux, however in the windows I get a message along the lines or "error cannot find Release / nnet.lib" during link time. Is there anything special I have to do to link to windows?

Change for example:

Main shared library (file names changed to protect the innocent):

ADD_LIBRARY(nnet SHARED src/nnet/file_1.cc src/nnet/file_3.cc src/nnet/file_2.cc src/nnet/file_4.cc) 

And then I create a python module that links in the library:

 # Build python module ADD_LIBRARY (other_lib SHARED ${CMAKE_SOURCE_DIR}/src/boost/boost_main.cc) TARGET_LINK_LIBRARIES (other_lib nnet ${PYTHON_LIBRARIES}) 

The rest is just a template (for example: changing the module extension to .pyd on windows, searching for python libraries / headers, etc.). And then when I build VS VS 2008, I get:

Fatal error LNK1181: cannot open input file 'Release \ nnet.lib'

when creating other_lib. Please note that no errors occur when building nnet.

+4
source share
1 answer

And, my problem is that I forgot to include __declspec (dllexport) in appropriate places when creating the library (can you say that I am not involved in Windows programming?).

+8
source

All Articles