MantisBT - CMake
View Issue Details
0013080CMakeCTestpublic2012-03-30 12:002012-09-03 16:00
Jean-Christophe Fillion-Robin 
David Cole 
normalminoralways
closedno change required 
CMake 2.8.7 
CMake 2.8.8 
0013080: CTEST_CMAKE_COMMAND ignored by "ctest_*" command.

If CTEST_CMAKE_COMMAND is set within a ctest script, its value isn't used.


If not explicitly set, should CTEST_CMAKE_COMMAND default to the value of cmake corresponding to the ctest program used to run the script ?
The attached archive bundle a very simple example illustrating the issue. I reproduced the problem using the following version of CMake/CTest:




Test case1:

~/Dashboards/Support/cmake-2.8.7-Linux-i386/bin/ctest -S drive_build.ctest -VV

Within drive_build.ctest:
   CTEST_CMAKE_COMMAND: /home/jchris/Dashboards/Support/cmake-2.8.8-rc1-Linux-i386/bin/cmake

Within CMakeLists.txt:
   cmake_minimum_required(VERSION 2.8.8)




Test case2

~/Dashboards/Support/cmake-2.8.6-Linux-i386/bin/ctest -S drive_build.ctest -VV

Within drive_build.ctest:
   CTEST_CMAKE_COMMAND: /home/jchris/Dashboards/Support/cmake-2.8.7-Linux-i386/bin/cmake

Within CMakeLists.txt:
    cmake_minimum_required(VERSION 2.8.7)
Example of output (Test case2)

* Extra verbosity turned on
Reading Script: /home/jchris/Projects/sandbox/ctest-cmake-command-ignored/drive_build.ctest
Before explicity setting CTEST_CMAKE_COMMAND:
After explicity setting CTEST_CMAKE_COMMAND:/home/jchris/Dashboards/Support/cmake-2.8.7-Linux-i386/bin/cmake
CTEST_SOURCE_DIRECTORY:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored
CTEST_BINARY_DIRECTORY:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored/build
SetCTestConfiguration:SourceDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored
SetCTestConfiguration:BuildDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored/build
Run dashboard with model Continuous
   Source directory: /home/jchris/Projects/sandbox/ctest-cmake-command-ignored
   Build directory: /home/jchris/Projects/sandbox/ctest-cmake-command-ignored/build
   Reading ctest configuration file: /home/jchris/Projects/sandbox/ctest-cmake-command-ignored/CTestConfig.cmake
SetCTestConfigurationFromCMakeVariable:NightlyStartTime:CTEST_NIGHTLY_START_TIMESetCTestConfiguration:NightlyStartTime:23:00:00 EDT
   Site:
   Build name:
   Use Continuous tag: 20120330-1557
SetCTestConfiguration:BuildDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored/build
SetCTestConfiguration:SourceDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored
SetCTestConfiguration:ConfigureCommand:"/home/jchris/Dashboards/Support/cmake-2.8.6-Linux-i386/bin/cmake" "-GUnix Makefiles" "/home/jchris/Projects/sandbox/ctest-cmake-command-ignored"
SetCTestConfiguration:BuildDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored/build
SetCTestConfiguration:SourceDirectory:/home/jchris/Projects/sandbox/ctest-cmake-command-ignored
Configure project
Configure with command: "/home/jchris/Dashboards/Support/cmake-2.8.6-Linux-i386/bin/cmake" "-GUnix Makefiles" "/home/jchris/Projects/sandbox/ctest-cmake-command-ignored"
Run command: "/home/jchris/Dashboards/Support/cmake-2.8.6-Linux-i386/bin/cmake" "-GUnix Makefiles" "/home/jchris/Projects/sandbox/ctest-cmake-command-ignored"
   Each . represents 1024 bytes of output
    .-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:8 (cmake_minimum_required):
  CMake 2.8.7 or higher is required. You are running version 2.8.6
No tags attached.
tgz ctest-cmake-command-ignored.tgz (898) 2012-03-30 12:00
https://public.kitware.com/Bug/file/4276/ctest-cmake-command-ignored.tgz
Issue History
2012-03-30 12:00Jean-Christophe Fillion-RobinNew Issue
2012-03-30 12:00Jean-Christophe Fillion-RobinFile Added: ctest-cmake-command-ignored.tgz
2012-03-30 12:08David ColeNote Added: 0029011
2012-03-30 12:52Jean-Christophe Fillion-RobinNote Added: 0029012
2012-03-30 13:09David ColeNote Added: 0029013
2012-03-30 13:34Jean-Christophe Fillion-RobinNote Added: 0029014
2012-03-30 15:24David ColeNote Added: 0029015
2012-03-30 15:25David ColeNote Edited: 0029013bug_revision_view_page.php?bugnote_id=29013#r585
2012-03-30 16:17Jean-Christophe Fillion-RobinNote Added: 0029017
2012-03-30 16:35David ColeAssigned To => David Cole
2012-03-30 16:35David ColeStatusnew => assigned
2012-03-30 16:36David ColeNote Edited: 0029015bug_revision_view_page.php?bugnote_id=29015#r587
2012-03-30 16:36David ColeStatusassigned => resolved
2012-03-30 16:36David ColeFixed in Version => CMake 2.8.8
2012-03-30 16:36David ColeResolutionopen => no change required
2012-09-03 16:00David ColeNote Added: 0030841
2012-09-03 16:00David ColeStatusresolved => closed

Notes
(0029011)
David Cole   
2012-03-30 12:08   
CTEST_CMAKE_COMMAND is intended to be a read-only variable. You should not set it within a ctest script.

By default, the ctest_configure command will use the cmake corresponding to the ctest being used to drive the script.

If you want to override it to use a different cmake explicitly for the configure step, you should set CTEST_CONFIGURE_COMMAND to customize the full command line of the configure step. See the code in Source/CTest/cmCTestConfigureCommand.cxx for details.
(0029012)
Jean-Christophe Fillion-Robin   
2012-03-30 12:52   
Thanks for clarification.

It's just that I initially based my understanding of this variable looking at existing scripts ...

It probably mean that the example reported here [1] should be updated.

Additionally, all our script within the "DashboardScripts" CVS repo all set this variable without using it directly in the script. Probably the evil "copy/paste" effect ...

[1] http://www.cmake.org/Wiki/CMake_Scripting_Of_CTest#CTest_Scripting [^]
(0029013)
David Cole   
2012-03-30 13:09   
(edited on: 2012-03-30 15:25)
Ah.... those things you point to are "old style" (pre-ctest_configure(), pre-ctest_build()) ctest scripts.

So we probably do support setting that var for old-style scripts.

But if you are using ctest_configure and ctest_build commands, you are by definition using a new-style script (2.4+) and should avoid setting CTEST_CMAKE_COMMAND. It's not used in new-style scripts.

(I forgot about those old style scripts already...)

(0029014)
Jean-Christophe Fillion-Robin   
2012-03-30 13:34   
Very true .. also forgot about that.

Before closing that issue, one last question:

Would it make sens to have CTEST_CMAKE_COMMAND available within a ctest script if it's invoked using "ctest -S </path/to/script>" ?

Or say differently is that variable expected to be valid when invoking a script that way ?
(0029015)
David Cole   
2012-03-30 15:24   
(edited on: 2012-03-30 16:36)
Try CMAKE_COMMAND : that should give you the full path to the corresponding CMake.

Even better, run this code in any CMake script/CMakeLists context to see what variables are defined and what their values are:

  get_cmake_property(vs VARIABLES)
  foreach(v ${vs})
    message("${v}='${${v}}'")
  endforeach()

(0029017)
Jean-Christophe Fillion-Robin   
2012-03-30 16:17   
Extra - thanks for the hint :) I believe the issue can now be closed.


FYI - Assuming -VV is used, within a ctest script message(STATUS "Hello") won't output anything whereas message("Hello") will output text.
(0030841)
David Cole   
2012-09-03 16:00   
Closing resolved issues that have not been updated in more than 4 months.