View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011629CMake(No Category)public2010-12-19 07:412010-12-20 08:57
ReporterCampbell Barton 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionno change required 
PlatformLinuxOSArchOS VersionArch 64bit
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0011629: CheckCCompilerFlag quirk.
DescriptionHi, we were having some problems with warnings and gcc versions so I
thought to write a macro that adds a flag to any string (typically
CMAKE_C_FLAGS)

ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS -Wno-unknown-pragmas)

...this is the macro.

macro(ADD_CHECK_C_COMPILER_FLAG
       _CFLAGS
       _FLAG)

       include(CheckCCompilerFlag)

       # odd workaround
       set(CFLAG_TEST "CFLAG_TEST")
       CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)
       if(CFLAG_TEST)
               # message(STATUS "Using CFLAG: ${_FLAG}")
               set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
       else()
               message(STATUS "Unsupported CFLAG: ${_FLAG}")
       endif()
endmacro()


My question is why this is needed?
       set(CFLAG_TEST "CFLAG_TEST")
       CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)

If I do this (as I see in other examples online)...
       CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)

This if check fails in CheckCSourceCompiles.cmake:28 ...

MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
 IF("${VAR}" MATCHES "^${VAR}$")

This is confusing since from what I can tell CFLAG_TEST can be an
undefined variable.
Any idea whats going on?
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0024281)
Brad King (manager)
2010-12-20 08:57

The issue tracker is not for questions. I'll answer the original mailing list post.

http://www.cmake.org/pipermail/cmake/2010-December/041408.html [^]

 Issue History
Date Modified Username Field Change
2010-12-19 07:41 Campbell Barton New Issue
2010-12-20 08:57 Brad King Note Added: 0024281
2010-12-20 08:57 Brad King Status new => closed
2010-12-20 08:57 Brad King Assigned To => Brad King
2010-12-20 08:57 Brad King Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team