I used CMAKE to create the Visual Studios C++ project for a library that I needed to build, and then I used VC++ to build the library. However, the time has come to rebuild the same library for cygwin so that I can link to it with the GNU tool chain (g++ make gdb). I've been trying to figure out how to configure CMAKE to build for cygwin but I'm not getting very far. I've checked the CMAKE website for help (and I will continue to search around there), but I barely have a grasp on what CMAKE really is, so I am having trouble finding the answers. Can anyone point me in a better direction? (Thanks, All.)
+2
A:
CMake is a build system. It's designed to let you write a single cross-platform build description, then it creates platform-specific build files (such as makefiles for the GNU toolchain) from that build setup.
To make it work under Cygwin, it should suffice to install the cmake
Cygwin package (using Cygwin's setup.exe
) then run commands similar to the following: (Since you'll be running CMake for Cygwin, you won't need to do anything to configure it for the GNU toolchain).
mkdir my-project-build
cd my-project-build
cmake /path/to/my-project
make
Josh Kelley
2010-08-27 16:32:27
make sure to use separate build directories for your g++ and visual studio builds. Also a handy tip is that if you use the code blocks generator you can use qtcreator for editing and compilation.
RobertJMaynard
2010-08-27 16:49:59
That sounds promising, but upon running cmake I received the following errors: CMake Error at /usr/share/cmake2.6.4/Modules/CMakeTestCCompiler.cmake:32 (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/tmp/HyDE_Source/build/CMakeFiles/CMakeTmpThis error message doesn't make sense, "which gcc" provides the expected results, and I can compile and run a basic helloWorld.c I'll keep this updated as I learn more. THANKS!
John Berryman
2010-08-27 17:48:50
That looks like cmake is having a user permission problem on entering or writing the test c file into that directory.I would also recommend upgrading to CMake 2.8
RobertJMaynard
2010-08-27 18:13:06
UPDATE: Fixed that problem. Apparently cmake had found a gmake.exe in its path (thanks MATLAB) and was preferentially using it instead of make. I deleted the MATLAB components from my path and that cleared up.
John Berryman
2010-08-27 18:44:39