View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012639CMakeCMakepublic2011-12-23 17:422011-12-24 14:18
ReporterPau Garcia i Quiles 
Assigned ToBill Hoffman 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionno change required 
PlatformMSVC2010SP1OSWindowsOS Version7 SP1 64-bit
Product VersionCMake 2.8.6 
Target VersionFixed in Version 
Summary0012639: CXX_FLAGS is not set unless a project asks for C++
DescriptionVisual 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 ReproduceSee attached minimal tests cases:
- fails
- passes (using workaround)
Additional InformationThe proper solution is to look for CXX_FLAGS if any source file has a property involving C++ language.
TagsNo tags attached.
Attached Files7z file icon cmakecxx.7z [^] (531 bytes) 2011-12-23 17:42

 Relationships

  Notes
(0028072)
Pau Garcia i Quiles (reporter)
2011-12-24 11:50

As Bill pointed in the mailing list, this can be solved by calling "enable_language(CXX)".

 Issue History
Date Modified Username Field Change
2011-12-23 17:42 Pau Garcia i Quiles New Issue
2011-12-23 17:42 Pau Garcia i Quiles File Added: cmakecxx.7z
2011-12-24 11:50 Pau Garcia i Quiles Note Added: 0028072
2011-12-24 14:18 Bill Hoffman Status new => closed
2011-12-24 14:18 Bill Hoffman Assigned To => Bill Hoffman
2011-12-24 14:18 Bill Hoffman Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team