Hi all,

Currently I am using a CompilerFlags.cmake file for setting all my flags, done 
with:

set(CMAKE_USER_MAKE_RULES_OVERRIDE 
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerFlags.cmake CACHE
STRING "Override makefile generation rules.")

In this CompilerFlags.cmake all targets (DEBUG, RELEASE,...) are set. After 
invoking my script on
the commandline of Windows7 with:
cmake -DCMAKE_BUILD_TYPE=DEBUG -Dbuild_hmi=on -G "MinGW Makefiles" 
..\..\work\trunk

I would expect that all flags are correctly setted. But when I take a look at 
the corresponding
files the flags are strange setted.

My c flags are setted twice (flags.make).
C_FLAGS = -g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast 
-Wcomments
-Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes 
-Wnested-externs
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs
-ftest-coverage -fmessage-length=0 -g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra 
-Wall
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes
-Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0

On the other side my c++ flags are not set (flags.make).
CXX_FLAGS = -g

My system is Windows7 and I am using CMake 2.8.0.

Thanks for your help.

Greetings

Alexander
###############################################################################
#
###############################################################################

# platform check first then check for environmente.
if(WIN32)
    # visual studio
    if(MSVC)
        # C
        set(CMAKE_C_FLAGS_DEBUG          "/D_DEBUG /W3 /Wall /Tc /MTd /Zi /Ob0 
/Od /RTC1")
        set(CMAKE_C_FLAGS_RELEASE        "/D NDEBUG /W3 /Wall /Tc /MT /O2 /Og 
/Ob2/GL")
        set(CMAKE_C_FLAGS_MINSIZEREL     "/D NDEBUG /W3 /Wall /Tc /MT /Ox /GL")
        set(CMAKE_C_FLAGS_RELWITHDEBINFO "/D NDEBUG /W3 /Wall /Tc /MT /ZI /O2 
/Ob1 /GL")
        
        # C++ 
        set(CMAKE_CXX_FLAGS_DEBUG          "/D_DEBUG /W3 /Wall /Tp /MTd /Zi 
/Ob0 /Od /RTC1")
        set(CMAKE_CXX_FLAGS_RELEASE        "/D NDEBUG /W3 /Wall /Tp /MT /O2 /Og 
/Ob2 /GL")
        set(CMAKE_CXX_FLAGS_MINSIZEREL     "/D NDEBUG /W3 /Wall /Tp /MT /Ox 
/GL")
        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/D NDEBUG /W3 /Wall /Tp /MT /ZI /O2 
/Ob1 /GL")

    #MinGW
    elseif(MINGW)
        # C
        #set(CMAKE_C_FLAGS                "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_C_FLAGS_DEBUG          "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
        set(CMAKE_C_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
        set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        
        # C++
        #set(CMAKE_CXX_FLAGS                "-g -DDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_CXX_FLAGS_DEBUG          "-g -DDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
        set(CMAKE_CXX_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    # cygwin environment
    elseif(CYGWIN)
        # C
        set(CMAKE_C_FLAGS                "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_C_FLAGS_DEBUG          "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
        set(CMAKE_C_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
        set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        
        # C++ 
        set(CMAKE_CXX_FLAGS                "-g -DDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_CXX_FLAGS_DEBUG          "-g -DDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
        set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
        set(CMAKE_CXX_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    endif(MSVC)
elseif(APPLE)
    MESSAGE(FATAL " There are no flags set for apple")
elseif(UNIX)
    # C
    set(CMAKE_C_FLAGS                "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    set(CMAKE_C_FLAGS_DEBUG          "-g -ggdb -ansi -std=c99 -DDEBUG -W 
-Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    set(CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
    set(CMAKE_C_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fmessage-length=0")
    set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    
    # C++ 
    set(CMAKE_CXX_FLAGS                "-g -DDEBUG -W -Wextra -Wall -Wshadow 
-Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    set(CMAKE_CXX_FLAGS_DEBUG          "-g -DDEBUG -W -Wextra -Wall -Wshadow 
-Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
    set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -W -Wextra -Wall -Wshadow 
-Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
    set(CMAKE_CXX_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fmessage-length=0")
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall 
-Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused 
-Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings 
-fprofile-arcs -ftest-coverage -fmessage-length=0")
else(WIN32)
    # C
    set(CMAKE_C_FLAGS_DEBUG          "-g -ggdb -ansi -std=c99 -DDEBUG -mfpu=vfp 
-mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wbad-function-cast 
-Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations 
-Wmissing-prototypes -Wnested-externs -Wold-style-definition 
-Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs 
-ftest-coverage -fmessage-length=0")
    set(CMAKE_C_FLAGS_RELEASE        "-O2 -ansi -std=c99 -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast 
-Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations 
-Wmissing-prototypes -Wnested-externs -Wold-style-definition 
-Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0")
    set(CMAKE_C_FLAGS_MINSIZEREL     "-O3 -Os -ansi -std=c99 -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast 
-Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations 
-Wmissing-prototypes -Wnested-externs -Wold-style-definition 
-Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0")
    set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -ansi -std=c99 -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast 
-Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations 
-Wmissing-prototypes -Wnested-externs -Wold-style-definition 
-Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs 
-ftest-coverage -fmessage-length=0")
      
    # C++ 
    set(CMAKE_CXX_FLAGS_DEBUG          "-g -DDEBUG -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable 
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers 
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs 
-ftest-coverage -fmessage-length=0")
    set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable 
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers 
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0")
    set(CMAKE_CXX_FLAGS_MINSIZEREL     "-O3 -Os -DNDEBUG -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable 
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers 
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0")
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -mfpu=vfp -mthumb 
-mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable 
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers 
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs 
-ftest-coverage -fmessage-length=0")
endif(WIN32)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to