I have a build that is very simple and essentially creates a shared library (an Emacs module).
The subdirectory CMakeLists.txt file just contains the following. The top CMakeLists.txt just contains, essentially, the definition of EMACS_MODULE_INCLUDE_DIR.
target_include_directories(platel_emacs_module
PUBLIC
“${EMACS_MODULE_INCLUDE_DIR}”
)
On Mac OS things work as advertised (following Steps 1-3 of the Tutorial). But on Windows with VS I get this error. Yes, the VS environment is set up properly. It appears that cmake creates a spurious target for which no build instructions are given; this seems to be for “testing”.
C:\Users\marco\Projects\Lang\ELisp\platel\platel_build>cmake --build .
MSBuild version 17.12.12+1cce77968 for .NET Framework
1>Checking Build System
Building Custom Rule C:/Users/marco/Projects/Lang/ELisp/platel/c/CMakeLists.txt
platel_emacs_module.c
platel.c
Generating Code…
platel_emacs_module.vcxproj → C:\Users\marco\Projects\Lang\ELisp\platel\platel_build\c\Debug\platel_emacs_module.dll
Building Custom Rule C:/Users/marco/Projects/Lang/ELisp/platel/CMakeLists.txt
platel_test.c LINK : fatal error LNK1104: cannot open file ‘c\Debug\platel_emacs_module.lib’ [C:\Users\marco\Projects\Lang\ELisp\plat****el\platel_build\platel_check.vcxproj]
The question is that cmake seems to create a target, without analyzing the spec (I do not pretend it analyzed the code), but it does so without any warning.
What am I after? A single spec that generated makefiles in a platform dependent way, and AFAIU, the Tutorials do not work on Windows.
Thank you. That helps. However, no mention of it (I may be wrong) is made in the Tutorial. Hence, if you try the tutorial on a Windows machine with VS installed (no other UN*X-like stuff), you are going to get stumped.
The problem is that the tutorial assumes a UN*X setup and Windows DLLs cannot be simply built.
Plus IMHO the MSVC build system generator is somewhat broken; it appears to create a project file which contains a broken .lib dependency: it should know better IMHO.
I think I reconstructed my personal issue with the Tutorial. Actually there are two. The first one is that, unlike my wife, I read a bit and then I try things; she reads everything beforehand.
Apart from that, I followed the tutorial and tried to build a SHARED library. Alas, the Tutorial (Step 2) does not build a SHARED library, but just links in an object, static, one.
Here is the catch: if you add SHARED to Step 2, TODO 1, the compilation on Windows with MSBuild fails with the error reported before (in an empty Step2_build folder; if you built the object file before and then just add SHARED to the MathFunctions/CMakeLists.txt add_library, the build would succeed (obviously)).
How to fix it? Add a note saying that to build SHARED libraries, especially on Windows, you need to RTMF about tarket_link_libraries. As it is now, you can run the tutorial Step 2 without problems on UN*X, but you need to add things on Windows.
Yes. A note in the Tutorial would suffice.
Nope. I have not yet figured out how to fix the issue.