On 3/29/2016 11:39, Sebastian Schuberth wrote:
>> $ cat CMakeLists.txt
>> cmake_minimum_required(VERSION 3.5)
>> project(test C)
>> message("${CMAKE_SIZEOF_VOID_P}")
>>
>> If that reproduces the problem, try configuring with --debug-trycompile
>> so that the CMakeFiles/CmakeTmp/CMakeFiles/cmTC_*.dir/build.make files
>> will be left behind for inspection.
>
> Yes, that does reproduce the issue, ${CMAKE_SIZEOF_VOID_P} evaluates to an
> empty string. I was looking at the CMakeFiles/cmTC_21eb3.dir/build.make file
> for CMakeCCompilerABI but was not seeing any suspicious. Calling
>
> $ /c/Ruby-DevKit/bin/make -f CMakeFiles/cmTC_21eb3.dir/build.make
> cmTC_21eb3.exe
>
> Also successfully builds the executable.
>
> What should I try next?
Ok, I seem to have found the root cause of the problem. Altough CMake is
correctly using gcc from C:/Ruby-DevKit/mingw/bin/gcc.exe, it's using gmake
from C:/Strawberry/c/bin/gmake.exe (which is from Strawberry Perl that I also
have installed). Ruby-DevKit does not come with gmake.exe, only with
bin/make.exe (and with mingw/bin/mingw32-make.exe). But for some reason CMake
seems to prefer gmake over make, despite the latter coming from the same parent
directory than gcc.
While C:/Ruby-DevKit/bin/make.exe is an executable linked against MSYS-1.0.DLL
that understands Unix-style paths on Windows, C:/Strawberry/c/bin/gmake.exe is
a native Windows exeutable linked against MSVCRT.DLL that does not. Removing
C:/Strawberry/c/bin from PATH so that CMake doe snot find gmake properly works
around the issue for me.
So far, so good, but I'm yet unsure what's the best / most generic fix for
this. As Ruby-DevKit is based on MSYS, I tried to replace "Unix Makefiles" in
$ cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "Unix Makefiles"
with "MSYS Makefiles" so that it reads
$ cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "MSYS Makefiles"
and that seems to work.
Brad, do you think that's a reasonable fix? What's the difference between
CMake's "Unix Makefiles" and "MSYS Makefiles" anyway?
Regards,
Sebastian
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake