[cmake-developers] [CMake 0013796]: Regression: Toolchain file including CMakeDetermineSystem no longer works
Mantis Bug Tracker
mantis at public.kitware.com
Fri Dec 14 08:55:23 EST 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13796
======================================================================
Reported By: raspy
Assigned To:
======================================================================
Project: CMake
Issue ID: 13796
Category: CMake
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-12-14 08:55 EST
Last Modified: 2012-12-14 08:55 EST
======================================================================
Summary: Regression: Toolchain file including
CMakeDetermineSystem no longer works
Description:
In CMake 2.8.10 there was a change introduced:
http://cmake.org/gitweb?p=cmake.git;a=commit;h=7195aca54f40778f41894c9e62649afe09e71d6c.
As a part of this change location of CMakeSystem.cmake generated file was
changed
(http://cmake.org/gitweb?p=cmake.git;a=blobdiff;f=Modules/CMakeDetermineSystem.cmake;h=cd33447560e12ac473d57ec5ad7784f7c5a1f861;hp=22c5016146bba896b8bbcb76458d420bd74c81b9;hb=7195aca54f40778f41894c9e62649afe09e71d6c;hpb=ec22a9b5217c2110db9af1791a61a7552144f028)
When the project is configured, it runs CMakeDetermineSystem which creates
CMakeSystem.cmake. We use CMAKE_TOOLCHAIN_FILE which is included by
CMakeDetermineSystem and its path is also written in CMakeSystem.cmake. Then the
compiler is tested; it is done by creating temporary CMake subproject to try to
compile a sample file. Issue is: in that subproject CMAKE_TOOLCHAIN_FILE is not
set, but it includes CMakeSystem.cmake. Our toolchain file includes
CMakeDetermineSystem which in turn overwrites CMakeSystem.cmake WITHOUT
toolchain file location. Therefore, when CMake is run next time it does not
include toolchain file and compiler's include location is not known.
The issue was not previously observed because CMakeSystem.cmake created by
temporary TryCompile subproject was created in temporary subproject's directory.
Now it is the same location for main project and subprojects and is being
overwritten.
Steps to Reproduce:
Use the following CMakeLists.txt:
SET(CMAKE_TOOLCHAIN_FILE toolchain.cmake)
PROJECT(test C CXX ASM)
ADD_LIBRARY(test foo.c)
toolchain.cmake:
INCLUDE_DIRECTORIES(include_dir)
IF(NOT CMAKE_HOST_SYSTEM_NAME)
INCLUDE(CMakeDetermineSystem)
ENDIF(NOT CMAKE_HOST_SYSTEM_NAME)
1. Run CMake 2.8.10.2. Check CMakeFiles/2.8.10.2/CMakeSystem.cmake does not
contain line including toolchain file.
2. Run make VERBOSE=1. Note that -Iinclude_dir is provided (because it was
cached from CMakeDetermineSystem).
3. Run CMake 2.8.10.2 again. Note that compiler settings are read from cache and
CMakeDetermineSystem is not called, but rather generated CMakeSystem.cmake is
included. As it lacks toolchain file include, toolchain file is not included and
INCLUDE_DIRECTORIES command is missing.
4. Run make VERBOSE=1 again. Note that -Iinclude_dir is now missing from
compilation line.
Additional Information:
This particular change
http://cmake.org/gitweb?p=cmake.git;a=blobdiff;f=Modules/CMakeDetermineSystem.cmake;h=cd33447560e12ac473d57ec5ad7784f7c5a1f861;hp=22c5016146bba896b8bbcb76458d420bd74c81b9;hb=7195aca54f40778f41894c9e62649afe09e71d6c;hpb=ec22a9b5217c2110db9af1791a61a7552144f028
introduced regression.
CMake up to 2.8.9 works with such toolchain file correctly (because
CMakeSystem.cmake is generated in CMakeFiles/ and CMakeFiles/CMakeTmp/CMakeFiles
separately). After the change they both use the same file location and the file
gets overwritten once compiler tests are run.
I would suggest to export CMAKE_TOOLCHAIN_FILE for test subprojects, so that at
least CMakeDetermineSystem generates the same CMakeSystem.cmake file.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-12-14 08:55 raspy New Issue
======================================================================
More information about the cmake-developers
mailing list