For a new project we want to use CMake. We are using Eclipse CDT as IDE and Cygwin gcc.
对于一个新的项目,我们想使用CMake。我们使用Eclipse CDT作为IDE和Cygwin gcc。
We generated the CMakeLists.txt and followed [this tutorial (option 2)][1].
我们生成CMakeLists。txt和follow[本教程(选项2)][1]。
When I try to run the described Make target to generate the Makefiles with CMake, which executes
当我尝试运行所描述的Make目标时,生成带有CMake的makefile,它执行。
cmake -E chdir C:/projects/eclipse_ws/MyApp/Build/ cmake -G "Unix Makefiles" ../ Run CMake
I get the error
我得到错误的
CMake Error: The source directory "C:/projects/eclipse_ws/MyApp/Build/CMake" does not exist.
If I run the command directly from a Cygwin console it works just fine, however then I have to run make also from the Cygwin console, because the Makefiles are generated with Unix paths.
如果我直接从Cygwin控制台运行命令,它运行得很好,但是,我还必须从Cygwin控制台运行make,因为makefile是通过Unix路径生成的。
EDIT:
编辑:
So I fixed this issue (see my answer below).
所以我解决了这个问题(参见下面的答案)。
But I'm still having problems.
但我还是有问题。
When I try to run CMake as Make target in Eclipse as suggested in the tutorial I get the following errors:
当我试图在Eclipse中运行CMake作为Make目标时,我得到了以下错误:
cmake -E chdir Build/ cmake -G 'Unix Makefiles' ../
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
System is unknown to cmake, create:
Platform/MINGW32_NT-6.1 to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake@www.cmake.org.
-- Check for working C compiler: /usr/bin/gcc.exe
System is unknown to cmake, create:
Platform/MINGW32_NT-6.1 to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
-- Check for working C compiler: /usr/bin/gcc.exe -- broken
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "/usr/bin/gcc.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles CMakeTmp
Run Build Command:/usr/bin/make.exe "cmTryCompileExec726566634/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec726566634.dir/build.make
CMakeFiles/cmTryCompileExec726566634.dir/build
make[1]: Entering directory
'/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report
/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp/CMakeFiles
1
Building C object
CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj
/usr/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj -c
/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp/testCCompiler.c
CMakeFiles/cmTryCompileExec726566634.dir/build.make:60: recipe for target
'CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj' failed
make[1]: Leaving directory
'/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj]
Error 1
Makefile:117: recipe for target 'cmTryCompileExec726566634/fast' failed
make: *** [cmTryCompileExec726566634/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
Seems like for some reason CMake assumes I have an MinGW environment and not Cygwin.
似乎出于某种原因CMake假设我有一个MinGW环境而不是Cygwin。
EDIT2 MinGW system was assumed, because a Git installation was in PATH before Cygwin and Git's uname command was used (which returns MinGW).
我们假设了EDIT2 MinGW系统,因为在Cygwin和Git的uname命令(返回MinGW)之前,有一个Git安装在PATH中。
1 个解决方案
#1
0
If you check "Make Target - Same as the target name" in Eclipse's Make dialog, Eclipse will add a
如果您在Eclipse的Make对话框中检查“Make Target - Same as the Target name”,Eclipse将添加一个。
Run CMake
to the command (see question), which is misinterpreted by CMake. I just unchecked "Same as the target name".
对命令(见问题),由CMake错误解释。我只是不加控制地“和目标名一样”。
#1
0
If you check "Make Target - Same as the target name" in Eclipse's Make dialog, Eclipse will add a
如果您在Eclipse的Make对话框中检查“Make Target - Same as the Target name”,Eclipse将添加一个。
Run CMake
to the command (see question), which is misinterpreted by CMake. I just unchecked "Same as the target name".
对命令(见问题),由CMake错误解释。我只是不加控制地“和目标名一样”。