Building on Windows Win32, cmake with -P option, FindBoost.cmake (add_library()) non scriptable


#1

I’m following the Windows build instructions here: https://docs.nsclient.org/manual/build.html

When I get to this step “nscp\build\python\fetchdeps.py --target --dyn --source --msver 2015”

It gets to the point of running this line: msbuild vsprojects\libprotobuf.vcxproj /p:Configuration=Release /p:DefineConstants=_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS

But this fails with the following errors [included small subset below]:

%mypath%\win32-build-folder\build\platform\protobuf-2.6.1\src\goo gle/protobuf/stubs/hash.h(38): fatal error C1083: Cannot open include file: ‘st ring.h’: No such file or directory [%mypath%\win32-build-folder\b uild\platform\protobuf-2.6.1\vsprojects\libprotobuf.vcxproj] descriptor.pb.cc %mypath%\win32-build-folder\build\platform\protobuf-2.6.1\src\goo gle/protobuf/descriptor.pb.h(7): fatal error C1083: Cannot open include file: ‘ string’: No such file or directory [%mypath%\win32-build-folder\b uild\platform\protobuf-2.6.1\vsprojects\libprotobuf.vcxproj] descriptor_database.cc %mypath%\win32-build-folder\build\platform\protobuf-2.6.1\src\goo gle/protobuf/descriptor_database.h(40): fatal error C1083: Cannot open include file: ‘map’: No such file or directory [%mypath%\win32-build-fold er\build\platform\protobuf-2.6.1\vsprojects\libprotobuf.vcxproj] dynamic_message.cc …\src\google\protobuf\dynamic_message.cc(65): fatal error C1083: Cannot open i nclude file: ‘algorithm’: No such file or directory [%mypath%\win 32-build-folder\build\platform\protobuf-2.6.1\vsprojects\libprotobuf.vcxproj] extension_set.cc %mypath%\win32-build-folder\build\platform\protobuf-2.6.1\src\goo gle/protobuf/stubs/hash.h(38): fatal error C1083: Cannot open include file: ‘st ring.h’: No such file or directory [%mypath%\win32-build-folder\b uild\platform\protobuf-2.6.1\vsprojects\libprotobuf.vcxproj]

Basically it can’t find any of the include files, not the STL ones or those part of protobuf. What do I need to do to get this to work? I know the STL headers are here (like map and algorithm, etc.): C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include, and the other files. Is there some additional setup that’s not mentioned in the page I cited above because I had assumed things like include directories would get automatically set up. I am running VS2015 and I have all the other things installed (Python, WiX, Perl, CMake, git client). I have all the correct versions as mentioned in the document except cmake I have a newer version 3.7.1. Any help would be greatly appreciated.


#2

[Trying to build on Windows x86 version]

I’ve made some progress I’m able to complete the fetchdeps.py without any issues, however now I’m having a problem when I run:

cmake -D TARGET=dist -D SOURCE=nscp -P nscp\check_deps.cmake

There is an issue finding boost, actually I think there is an actual bug here because in FindBoost.cmake in the cmake modules, line 1002-1006

if(NOT TARGET Boost::diagnostic_definitions) add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) add_library(Boost::disable_autolinking INTERFACE IMPORTED) add_library(Boost::dynamic_linking INTERFACE IMPORTED) endif()

I get an error here which I found basically means when I run the command with the -P argument, add_library() is not scriptable so it errors out. Until this completes the dist directory won’t be created and I can’t proceed any further. How do I get around this? Any help would be greatly appreciated.


#3

I was using CMake 3.7, I’m switching to CMake 2.6 as advised in the instructions, that resolves this issue because the FindBoost.cmake files with the older versions of cmake do not have the add_library calls. For anyone else hitting this, you will need cmake 2.6.3 or greater or else check_deps.cmake will throw an error. I’ll report back in a bit I’m starting from scratch with cmake 2.6.4.