CMAKE_C_FLAGS reset to empty string

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CMAKE_C_FLAGS reset to empty string

Ingolf Steinbach
Hi,

Why are the CMAKE_C_FLAGS reset to the empty string when calling cmake
as shown below? (Using cmake 2.6.4 on Linux). When I later call ccmake
in the top-level build directory, the CMAKE_C_FLAGS variable does not
contain the value specified in the toolchain file but is instead
empty. The specified flags are not used for compilation of C sources.
No other cmake related file in my sources explicitly modifies that
variable.

Kind regards
Ingolf

########################################################
Invocation:
cmake -DCMAKE_MODULE_PATH="./cmake"
-DCMAKE_TOOLCHAIN_FILE="./cmake/toolchain.cmake"
-DCMAKE_BUILD_TYPE=Debug
########################################################
./cmake/toolchain.cmake:
set(CMAKE_SYSTEM_NAME foo)
set(CMAKE_SYSTEM_VERSION 3.1.4)
set(CMAKE_SYSTEM_PROCESSOR bar)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_FIND_ROOT_PATH /opt/foo)
set(CMAKE_C_COMPILER ${CMAKE_FIND_ROOT_PATH}/bin/bar-foo-gcc)

set(CMAKE_C_FLAGS "-Wall -W -mcpu=bar")
########################################################
./cmake/Platform/foo.cmake:
set(UNIX 1)

set(CMAKE_C_OUTPUT_EXTENSION .o)

set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS OFF)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
_______________________________________________
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 | Threaded
Open this post in threaded view
|

Re: CMAKE_C_FLAGS reset to empty string

Ingolf Steinbach
2009/12/8 Ingolf Steinbach <[hidden email]>:
> (Using cmake 2.6.4 on Linux). When I later call ccmake
> in the top-level build directory, the CMAKE_C_FLAGS variable does not
> contain the value specified in the toolchain file but is instead
> empty. The specified flags are not used for compilation of C sources.

Repeating the same experiment using cmake 2.8.0 on Linux still shows
empty CMAKE_C_FLAGS when looking at the variables with ccmake with the
top-level directory.

However, the compilation is now performed with the expected
CMAKE_C_FLAGS (i.e. those specified in the toolchain file).

Do you have an explanation for this?

Ingolf
_______________________________________________
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