View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013038CMakeCMakepublic2012-03-12 13:042012-09-03 16:00
ReporterMarcin Wojdyr 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSLinuxOS Version
Product VersionCMake 2.8.7 
Target VersionFixed in Version 
Summary0013038: cannot set CMAKE_AR when cross-compiling Fortran-only project
DescriptionI'm trying to cross-compile LAPACK 3.4.0 on Fedora using MinGW cross-compiler.
Binutils paths are not set correctly.

The CMAKE_AR in cache file is set to /usr/bin/ar, even if I explicitly set in toolchain file
SET(CMAKE_AR:FILEPATH /usr/bin/i686-pc-mingw32-ar)
or
SET(CMAKE_AR /usr/bin/i686-pc-mingw32-ar)

The only way to have the paths set correctly is to do:
SET(_CMAKE_TOOLCHAIN_PREFIX i686-pc-mingw32-)
but this is cmake internal variable.

I don't know cmake well, so I may be wrong, but I'd suppose there are two issues here.

1. _CMAKE_TOOLCHAIN_PREFIX is set in CMakeDetermineCCompiler and CMakeDetermineCXXCompiler.cmake, but not in CMakeDetermineFortranCompiler.
Most of Fortran projects use also C, so it is set anyway, but LAPACK has only Fortran.

2. CMAKE_AR and CMAKE_RANLIB set explicitly are not respected.

Last note: it used to work, I cross-compiled this or previous lapack version with cmake 2.8.5 or 6.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0028897)
Brad King (manager)
2012-03-12 15:24

In the toolchain file try

  set(CMAKE_AR /usr/bin/i686-pc-mingw32-ar CACHE FILEPATH "Archiver")

and then test with a fresh build tree.
(0028898)
Marcin Wojdyr (reporter)
2012-03-12 16:15

It works. Could you explain why?
(0028899)
Brad King (manager)
2012-03-12 16:20

CMAKE_AR caches the result for "find_program":

  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_program [^]
  "A cache entry named by <VAR> is created to store the result of this command."

Read the documentation of the "set" command:

  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set [^]
  "If CACHE is present, then the <variable> is put in the cache."

to see how to set cache values. Please visit the mailing list:

  http://www.cmake.org/mailman/listinfo/cmake [^]

for further help.
(0030835)
David Cole (manager)
2012-09-03 16:00

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-03-12 13:04 Marcin Wojdyr New Issue
2012-03-12 15:24 Brad King Note Added: 0028897
2012-03-12 16:15 Marcin Wojdyr Note Added: 0028898
2012-03-12 16:20 Brad King Note Added: 0028899
2012-03-12 16:20 Brad King Status new => resolved
2012-03-12 16:20 Brad King Resolution open => no change required
2012-03-12 16:20 Brad King Assigned To => Brad King
2012-09-03 16:00 David Cole Note Added: 0030835
2012-09-03 16:00 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team