MantisBT - CMake
View Issue Details
0014366CMakeCMakepublic2013-08-19 06:352014-07-24 13:46
Stephen Kelly 
Stephen Kelly 
normalminoralways
closedfixed 
CMake 2.8.12 
CMake 3.0 
0014366: Command line definitions ignored if -DCMAKE_C_COMPILER is passed

In the Qt 5 unit tests, we pass the compilers at each test run to workaround broken configuration in the CI system:

 https://bugreports.qt-project.org/browse/QTQAINFRA-609 [^]

However, this means that at each invocation after the first, command line content is not processed:

$ cmake .. -DTESTVAR=True -DCMAKE_C_COMPILER=gcc
TESTVAR = True
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= gcc

-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/lib/icecc/bin/gcc
-- Check for working C compiler: /usr/lib/icecc/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
TESTVAR =
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stephen/dev/src/playground/cmake/build

CMakeLists.txt:

message("TESTVAR = ${TESTVAR}")

No tags attached.
has duplicate 0014294closed Brad King Specifying CMAKE_CXX_COMPILER=g++ after first run deletes all cached values 
Issue History
2013-08-19 06:35Stephen KellyNew Issue
2013-08-19 07:37David ColeNote Added: 0033732
2013-08-19 08:04Stephen KellyNote Added: 0033733
2013-08-19 08:36Stephen KellyNote Added: 0033734
2014-01-07 09:22Stephen KellyStatusnew => resolved
2014-01-07 09:22Stephen KellyFixed in Version => CMake 3.0
2014-01-07 09:22Stephen KellyResolutionopen => fixed
2014-01-07 09:22Stephen KellyAssigned To => Stephen Kelly
2014-06-02 08:37Robert MaynardNote Added: 0036070
2014-06-02 08:37Robert MaynardStatusresolved => closed
2014-07-24 13:46Brad KingRelationship addedhas duplicate 0014294

Notes
(0033732)
David Cole   
2013-08-19 07:37   
Have you tried using -D along with the full path to the compiler?

(instead of just "gcc"...)
(0033733)
Stephen Kelly   
2013-08-19 08:04   
Yes, that works.
(0033734)
Stephen Kelly   
2013-08-19 08:36   
I added 8b2a2db to next to fix this.
(0036070)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.