xunzhang / gflags

Automatically exported from code.google.com/p/gflags
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

CMake version cannot compile on Windows #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Checkout the 'cmake-migration' branch.
2. CMake with gcc 4.7 with mingw64.
3. Make.

What is the expected output? What do you see instead?

In file included from D:\Projects\saedb\external\gflags\src\gflags.cc:90:0:
D:/Projects/saedb/build/external/gflags/include/gflags/config.h:84:28: fatal 
error: windows/port.h: No such file or directory
compilation terminated.
mingw32-make[2]: *** [external/gflags/CMakeFiles/gflags.dir/src/gflags.cc.obj] 
Error 1
mingw32-make[1]: *** [external/gflags/CMakeFiles/gflags.dir/all] Error 2
mingw32-make: *** [all] Error 2

Original issue reported on code.google.com by jian...@thinxer.com on 21 May 2013 at 12:36

GoogleCodeExporter commented 9 years ago
Hi, thanks for letting me know. This branch is, however, in development yet and 
therefore not surprising that it does not compile. I noticed earlier that I had 
removed too many files that are actually needed for the build on Windows, but 
had not found the time so far to fix this problem. I will update this issue 
once this has been fixed.

Original comment by andreas....@gmail.com on 21 May 2013 at 10:45

GoogleCodeExporter commented 9 years ago
I added the missing files (now named windows_port.h|cc to avoid unnecessary 
subdirectory). See 
https://github.com/schuhschuh/gflags/commit/4eb2cb223b6c2cbab7093a9fca56732c53ec
143a . Please test this update and report back if it compiles now or not.

Original comment by andreas....@gmail.com on 21 May 2013 at 11:09

GoogleCodeExporter commented 9 years ago
Thanks for the quick reply.

First, I removed the "src" prefix in the following path, otherwise CMake will 
complain about not finding them.

if (WIN32)
  list (APPEND PRIVATE_HDRS "src/windows_port.h")
  list (APPEND GFLAGS_SRCS  "src/windows_port.cc")
endif ()

Then CMake succeeded. I tried to compile but it was still complaining:

In file included from D:\Projects\saedb\external\gflags\src\gflags.cc:90:0:
D:/Projects/saedb/build/external/gflags/include/gflags/config.h:89:28: fatal 
error: windows_port.h: No such file or directory
compilation terminated.
mingw32-make[2]: *** [external/gflags/CMakeFiles/gflags.dir/src/gflags.cc.obj] 
Error 1
mingw32-make[1]: *** [external/gflags/CMakeFiles/gflags.dir/all] Error 2
mingw32-make: *** [all] Error 2

I tried to add the source folder into include_directories, but 
'windows_port.h‘ still cannot be found.

Original comment by jian...@thinxer.com on 22 May 2013 at 2:13

GoogleCodeExporter commented 9 years ago
Thanks for pointing out the fixes. I remove the "src/" prefix in the 
CMakeLists.txt and added the "${PROJECT_SOURCE_DIR}/src" directory to the 
include path. This should actually solve the "No such file or directory" error. 
Can you please try it again?

Original comment by andreas....@gmail.com on 22 May 2013 at 10:57

GoogleCodeExporter commented 9 years ago
It's working now. :)

Original comment by jian...@thinxer.com on 22 May 2013 at 5:45

GoogleCodeExporter commented 9 years ago
Nice. :)

Original comment by andreas....@gmail.com on 22 May 2013 at 6:04

GoogleCodeExporter commented 9 years ago
The upcoming v2.1 release build fine in both static/shared with VS2008/2012, 
Cygwin, and MinGW.

Original comment by andreas....@gmail.com on 20 Mar 2014 at 3:47