[cmake-developers] [CMake 0014268]: Setting CMAKE_CXX_FLAGS can break check_cxx_compiler_flag

Mantis Bug Tracker mantis at public.kitware.com
Wed Jul 3 12:15:34 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14268 
====================================================================== 
Reported By:                Stephen Kelly
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14268
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-07-03 12:15 EDT
Last Modified:              2013-07-03 12:15 EDT
====================================================================== 
Summary:                    Setting CMAKE_CXX_FLAGS can break
check_cxx_compiler_flag
Description: 

cmake_minimum_required(VERSION 2.8)
project(Foo)

# As done by Tests/IncludeDirectories. Comment out to fix:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \"-I${CMAKE_BINARY_DIR}/Flags\"")

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-W HAS_DASH_W)
message("HAS_DASH_W: ${HAS_DASH_W}")
if (NOT HAS_DASH_W)
  message("OUTPUT: ${OUTPUT}")
endif()



stephen at hal:~/dev/src/playground/cmake/build{master}$ cmake ..
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/lib/icecc/bin/cc
-- Check for working C compiler: /usr/lib/icecc/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test HAS_DASH_W
-- Performing Test HAS_DASH_W - Failed
HAS_DASH_W: 
OUTPUT: Change Dir:
/home/stephen/dev/src/playground/cmake/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec1180065894/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1180065894.dir/build.make
CMakeFiles/cmTryCompileExec1180065894.dir/build
make[1]: Entering directory
`/home/stephen/safe/dev/playground/cmake/build/CMakeFiles/CMakeTmp'
/home/stephen/dev/prefix/qtbase/kde/bin/cmake -E cmake_progress_report
/home/stephen/dev/src/playground/cmake/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1180065894.dir/src.cxx.o
/usr/lib/icecc/bin/c++    ;-I/home/stephen/dev/src/playground/cmake/build/Flags"
 -DHAS_DASH_W"   -W -o CMakeFiles/cmTryCompileExec1180065894.dir/src.cxx.o -c
/home/stephen/dev/src/playground/cmake/build/CMakeFiles/CMakeTmp/src.cxx
c++: fatal error: no input files
compilation terminated.
/bin/sh: 1: -I/home/stephen/dev/src/playground/cmake/build/Flags  -DHAS_DASH_W:
not found
make[1]: *** [CMakeFiles/cmTryCompileExec1180065894.dir/src.cxx.o] Error 127
make[1]: Leaving directory
`/home/stephen/safe/dev/playground/cmake/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec1180065894/fast] Error 2

-- Configuring done
-- Generating done
-- Build files have been written to:
/home/stephen/dev/src/playground/cmake/build

I tested with CMake 2.6.4, which also has the bug.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-07-03 12:15 Stephen Kelly  New Issue                                    
======================================================================




More information about the cmake-developers mailing list