View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013503CMakeCMakepublic2012-08-31 07:422015-11-02 09:13
ReporterStephen Kelly 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSWindows 7 64 bitOS Version
Product VersionCMake 2.8.9 
Target VersionFixed in VersionCMake 3.3 
Summary0013503: CMake fails with Visual Studio generator if CMAKE_TOOLCHAIN_FILE is defined empty
Description
With any cmake project with the Visual Studio 10 generator on Windows, a specified but empty CMAKE_TOOLCHAIN_FILE causes problems:

c:\QtDev\cmaketest\build>cmake .. -DCMAKE_TOOLCHAIN_FILE=
-- Building for: Visual Studio 10
CMake Warning (dev) at build/CMakeFiles/CMakeSystem.cmake:1 (INCLUDE):
  include() given empty file name (ignored).
Call Stack (most recent call first):

This warning is for project developers. Use -Wno-dev to suppress it.

-- Check for working C compiler using: Visual Studio 10
CMake Warning (dev) at C:/QtDev/cmaketest/build/CMakeFiles/CMakeSystem.cmake:1 (
INCLUDE):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
CMake Warning (dev) at C:/QtDev/cmaketest/build/CMakeFiles/CMakeSystem.cmake:1 (
INCLUDE):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
CMake Warning (dev) at C:/QtDev/cmaketest/build/CMakeFiles/CMakeSystem.cmake:1 (
INCLUDE):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)
This warning is for project developers. Use -Wno-dev to suppress it.

The problem seems to be

  if(DEFINED CMAKE_TOOLCHAIN_FILE)
    set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "include(\"${CMAKE_TOOLCHAIN_FILE}\")")
  endif()

in CMakeDetermineSystem.cmake. I do not know why it does not hit

    message(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")

 earlier in that file. I also do not know why this does not fail with the NMake makefile generator, or the Unix Makefile generator.

https://bugreports.qt-project.org/browse/QTBUG-27087 [^]
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0030813)
Brad King (manager)
2012-08-31 15:59

The current logic was introduced here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b100fe1f#patch1 [^]

Try this patch:

diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index cd33447..3a6560d 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -164,7 +164,7 @@ if(CMAKE_BINARY_DIR)
   # if a toolchain file is used, it needs to be included in the configured file,
   # so settings done there are also available if they don't go in the cache and in try_compile()
   set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED)
-  if(DEFINED CMAKE_TOOLCHAIN_FILE)
+  if(CMAKE_TOOLCHAIN_FILE)
     set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "include(\"${CMAKE_TOOLCHAIN_FILE}\")")
   
endif()
 
(0038594)
Stephen Kelly (developer)
2015-04-24 15:30

http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22926dd6 [^]
 Allow CMAKE_TOOLCHAIN_FILE to be an empty string
(0039788)
Robert Maynard (manager)
2015-11-02 09:13

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

 Issue History
Date Modified Username Field Change
2012-08-31 07:42 Stephen Kelly New Issue
2012-08-31 15:59 Brad King Note Added: 0030813
2015-04-24 15:30 Stephen Kelly Note Added: 0038594
2015-04-24 15:30 Stephen Kelly Status new => resolved
2015-04-24 15:30 Stephen Kelly Fixed in Version => CMake 3.3
2015-04-24 15:30 Stephen Kelly Resolution open => fixed
2015-04-24 15:30 Stephen Kelly Assigned To => Brad King
2015-11-02 09:13 Robert Maynard Note Added: 0039788
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team