[cmake-developers] Shared library under Windows and CMake: DLL not found before installation
Joachim Wuttke
j.wuttke at fz-juelich.de
Wed Feb 6 13:46:36 EST 2019
The library `mylib` consists of the library proper, in directory `lib/`, and a
test suite, in directory `test/`. It is completely under CMake control:
mylib/CMakeLists.txt:
...
add_subdirectory(lib)
add_subdirectory(test)
...
mylib/lib/CMakeLists.txt:
...
add_library(my_lib ${src_files})
...
mylib/test/CMakeLists.txt:
...
add_executable(mytest mytest.c)
target_link_libraries(mytest mylib)
Build steps are:
mkdir build
cd build
cmake ..
make
ctest # or make test
make install
Works under Linux, stable since many years. Under Windows10 though, a message window
pops up, entitled "mytest.exe - System error": "The code execution cannot proceed
because mylib.dll was not found. Reinstalling the program may fix this problem."
No, installing (rather than reinstalling) would not be a good solution: I need to
first test the library before I install it (btw: this excludes most solutions
proposed in response to somewhat similar questions).
Isn't CMake supposed to work cross-platform? What is the minimally invasive adjustment
to make the above build steps work under Windows?
Disclosure: this is a cross-posting from https://stackoverflow.com/questions/54560434.
Thanks for any help - Joachim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190206/ccc20752/attachment.bin>
More information about the cmake-developers
mailing list