[cmake-developers] [CMake 0012496]: Compiler tests ignore variables from command line when using toolchain file

Mantis Bug Tracker mantis at public.kitware.com
Thu Oct 6 03:50:06 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12496 
====================================================================== 
Reported By:                Markus Klinik
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12496
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-10-06 03:50 EDT
Last Modified:              2011-10-06 03:50 EDT
====================================================================== 
Summary:                    Compiler tests ignore variables from command line
when using toolchain file
Description: 
Have a toolchain file that sets cache variables. On the
command line, override the default values using the -D option. The overrides
are ignored by the configure-time compiler tests, but the overrides go to the
generated makefiles.

Example:

--- toolchain.cmake
set(ANDROID_NDK_ROOT "/home/nosuchuser/android-ndk-r6b" CACHE PATH "Android NDK
root")
message("ANDROID_NDK_ROOT is: " ${ANDROID_NDK_ROOT})
--- end of toolchain.cmake

--- CMakeLists.txt
project(foobar)
--- end of CMakeLists.txt

run cmake with the following command:

$ cmake -DANDROID_NDK_ROOT=/home/mkl/android-ndk
-DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake ..

and observe that ANDROID_NDK_ROOT takes on the default value for the compiler
tests:

ANDROID_NDK_ROOT is: /home/mkl/android-ndk
ANDROID_NDK_ROOT is: /home/mkl/android-ndk
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
ANDROID_NDK_ROOT is: /home/nosuchuser/android-ndk-r6b
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
ANDROID_NDK_ROOT is: /home/nosuchuser/android-ndk-r6b
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
ANDROID_NDK_ROOT is: /home/nosuchuser/android-ndk-r6b
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
ANDROID_NDK_ROOT is: /home/nosuchuser/android-ndk-r6b
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-10-06 03:50 Markus Klinik  New Issue                                    
======================================================================




More information about the cmake-developers mailing list