MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0004539 | CMake | Modules | public | 2007-03-06 14:21 | 2016-06-10 14:30 |
| Reporter | Galmes Pierre-André | ||||
| Assigned To | Eric Wing | ||||
| Priority | low | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0004539: linking issue with FindSDL.cmake and mingw / msys | ||||
| Description | The short version: When compiling a project with cmake, the generated linking line has not all the flags needed. It lacks -lmingw32 -lSDLmain -lSDL -lmwindows. check also this mail: http://www.mail-archive.com/cmake@cmake.org/msg05054.html [^] The long version: Hello, I've been playing for some days with cmake, and I have to say that I quite love the way it works. But while trying to compile a sourceforge project under Windows using MSYS, I run into a problem. I do not know if the problem is related to the CMakeLists.txt that I did not wrote correctly or to an issue into the FindSDL.cmake. That's why I write here. What I did: - I wrote the CMakeLists.txt under Linux. There, everything compiled like a charm. I added the code of my CMakeLists.txt at the end of the mail - Under Windows, I then generated the make files for MSYS and tried to compile it using msys and mingw: $ make Scanning dependencies of target bloodybeard [ 25%] Building CXX object CMakeFiles/bloodybeard.dir/main.obj [ 50%] Building CXX object CMakeFiles/bloodybeard.dir/qGameEngine.obj [ 75%] Building CXX object CMakeFiles/bloodybeard.dir/moc_qGameEngine.obj Linking CXX executable bloodybeard.exe CMakeFiles/bloodybeard.dir/qGameEngine.obj(.text+0x1d7):qGameEngine.cpp: undefined reference to `SDL_Init' CMakeFiles/bloodybeard.dir/qGameEngine.obj(.text+0x1eb):qGameEngine.cpp : undefined reference to `SDL_WM_SetCaption' ... So, the SDL lib is not correctly linked under Windows/MSYS. I then checked the "build.make" file generated. It does not includes all the needed link flags needed for SDL under mingw ( -lmingw32 -lSDLmain -lSDL -lmwindows). Why aren't those flags added? It looks like the SDL_LIBRARY variable is empty, but why ? I would need some help to investigate further. - In the FindSDL.cmake, there is a specific part related to MINGW: # MinGW needs an additional library, mwindows # It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows # (Actually on second look, I think it only needs one of the m* libraries.) IF(MINGW) SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") ENDIF(MINGW) So, why doesn't this work ? Is there a specific MSYS flag to add? I have a few workarounds in order to compile my project, but would like to help. Regards, Pierre-André Galmes I - Links: The project is at the following adress: http://sourceforge.net/projects/bloodybeard [^] You can access to the svn source if you want to. II - CMakeLists.txt : check the web page: http://www.mail-archive.com/cmake@cmake.org/msg05054.html [^] | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2008-10-08 09:16 | Bill Hoffman | Assigned To | Bill Hoffman => Eric Wing | ||
| 2011-01-18 12:06 | David Cole | Note Added: 0024879 | |||
| 2016-06-10 14:27 | Kitware Robot | Note Added: 0041345 | |||
| 2016-06-10 14:27 | Kitware Robot | Status | assigned => resolved | ||
| 2016-06-10 14:27 | Kitware Robot | Resolution | open => moved | ||
| 2016-06-10 14:30 | Kitware Robot | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||