MantisBT - CMake
View Issue Details
0012496CMakeCMakepublic2011-10-06 03:502016-06-10 14:31
Markus Klinik 
Alex Neundorf 
normalminoralways
closedmoved 
CMake 2.8.5 
 
0012496: Compiler tests ignore variables from command line when using toolchain file
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
No tags attached.
Issue History
2011-10-06 03:50Markus KlinikNew Issue
2011-10-06 03:50Markus KlinikNote Added: 0027538
2011-10-06 11:33Alex NeundorfAssigned To => Alex Neundorf
2011-10-06 11:33Alex NeundorfStatusnew => assigned
2012-08-13 14:32Alex NeundorfStatusassigned => backlog
2015-12-06 15:27Trygve LaugstølNote Added: 0039956
2016-06-10 14:28Kitware RobotNote Added: 0041909
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0027538)
Markus Klinik   
2011-10-06 03:50   
see also http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/33364/focus=34200 [^]
(0039956)
Trygve Laugstøl   
2015-12-06 15:27   
This is a problem for me too. Are there any available workardounds?
(0041909)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.