[CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

Brad King brad.king at kitware.com
Thu Mar 24 11:53:04 EDT 2016


On 03/24/2016 11:28 AM, Sebastian Schuberth wrote:
> Configuring libgit2 fails as CMake does not set CMAKE_SIZEOF_VOID_P
> (nor CMAKE_C_SIZEOF_DATA_PTR), see the attached CMakeCCompiler.cmake file.
> 
> I tried to search CMake's source code to find out how the value of
> @CMAKE_C_SIZEOF_DATA_PTR@ is determined in CMakeCCompiler.cmake.in,
> but I failed. Does anyone have suggestions on how to debug this further,
> or what the possible root causes might be?

It is supposed to be done here:

 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerABI.cmake;hb=v3.5.0#l23
 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeCCompilerABI.c;hb=v3.5.0

The try_compile produces a binary file that encodes strings with the
information.  Then we use file(STRINGS) to parse the strings right out
of the binary.  The INFO:sizeof_dptr[...] string contains the size of
data pointer types.

Check CMakeFiles/CMake{Output,Error}.log to see if anything went wrong
with that step that was logged.  Otherwise you can add debugging code.

-Brad



More information about the CMake mailing list