MantisBT - CMake
View Issue Details
0014184CMakeCMakepublic2013-06-01 03:432014-10-06 10:33
steve.k.chiu 
Peter Kuemmel 
normalmajoralways
closedfixed 
Windows + Ninja + Mingw64-32Windows8
CMake 2.8.11 
CMake 3.0 
0014184: link_directories produce backslash path for mingw
The link_directories command produce backslash path which does not work in the mingw+ninja environment. All the others path (e.g. include path) are forward-slash, it seems the link_directories path has been forgotten.
1. add the link_directories command to the CMakeLists.txt
2. use Ninja generator and MinGW compiler (from mingw64 project)
3. the gcc compiler complain can not find the specified library (for ex. c:/qt/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lraw_r)
No tags attached.
Issue History
2013-06-01 03:43steve.k.chiuNew Issue
2013-06-01 04:42Rolf Eike BeerNote Added: 0033163
2013-06-02 03:43steve.k.chiuNote Added: 0033166
2013-06-03 08:49Brad KingNote Added: 0033175
2013-06-03 08:50Brad KingAssigned To => Peter Kuemmel
2013-06-03 08:50Brad KingStatusnew => assigned
2014-04-13 05:26Peter KuemmelNote Added: 0035682
2014-04-13 05:26Peter KuemmelStatusassigned => resolved
2014-04-13 05:26Peter KuemmelFixed in Version => CMake 3.0
2014-04-13 05:26Peter KuemmelResolutionopen => fixed
2014-10-06 10:33Robert MaynardNote Added: 0036968
2014-10-06 10:33Robert MaynardStatusresolved => closed

Notes
(0033163)
Rolf Eike Beer   
2013-06-01 04:42   
Could you plase add a minimal CMakeLists.txt to reproduce this and a build log showing the error?

Beside that you shouldn't be using link_directories anyway. use target_link_libraries with an absolute path to the lib.
(0033166)
steve.k.chiu   
2013-06-02 03:43   
Note this problem happens only when the command line is too long, and ninja add the link directories to the .rsp file. Apparently .rsp file treat backslash char as escape sequence, so it has problem finding the correctly directory.
(0033175)
Brad King   
2013-06-03 08:49   
I think Ninja started putting link libraries in .rsp files here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f647cf5 [^]

but only when the length is beyond the command line limit.
(0035682)
Peter Kuemmel   
2014-04-13 05:26   
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa21ae696d55c46231cf0a429afe900ad6e3cc9f [^]
(0036968)
Robert Maynard   
2014-10-06 10:33   
Closing resolved issues that have not been updated in more than 4 months.