[cmake-developers] [CMake 0012639]: CXX_FLAGS is not set unless a project asks for C++

Mantis Bug Tracker mantis at public.kitware.com
Fri Dec 23 17:42:11 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12639 
====================================================================== 
Reported By:                Pau Garcia i Quiles
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12639
Category:                   CMake
Reproducibility:            always
Severity:                   block
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-12-23 17:42 EST
Last Modified:              2011-12-23 17:42 EST
====================================================================== 
Summary:                    CXX_FLAGS is not set unless a project asks for C++
Description: 
Visual C++ 2010 does not support C99 yet and it seems it will be a
long time before MSVC supports it. For now, the usual work-around is
to build the project as C++.

I'd like to build as C if using mingw, and as C++ if using MSVC. 

As Bill and others suggested, I'm using set_source_files_properties(<SRCS>
PROPERTIES LANGUAGE CXX).

Problem is the configure step works fine but the generation step fails because
CXX_FLAGS have not been set. 

Work-around: include a dummy project that just sets "project(dummy CXX)" so that
C++ flags are registered.

See this thread for more details:

http://www.cmake.org/pipermail/cmake/2011-December/048222.html



Steps to Reproduce: 
See attached minimal tests cases:
- fails
- passes (using workaround)


Additional Information: 
The proper solution is to look for CXX_FLAGS if any source file has a property
involving C++ language.

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-12-23 17:42 Pau Garcia i QuilesNew Issue                                   

2011-12-23 17:42 Pau Garcia i QuilesFile Added: cmakecxx.7z                     

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




More information about the cmake-developers mailing list