[CMake] add_test CONFIGURATIONS and linux

Steve M. Robbins steve at sumost.ca
Wed Sep 14 02:12:01 EDT 2016


[Re-sending in text-form]

Hi,

I'm failing to be able to use "run-only-in-release" tests when running under 
linux (Debian).   Below is a short reproduction.

CmakeLists.txt
=============
cmake_minimum_required(VERSION 3.0)

enable_testing()
add_test(NAME list-stuff
  CONFIGURATIONS Release
  COMMAND ls)
=============

My understanding is that test will run only when the "configuration" is 
release.  I am guessing that for the single-configuration Makefile generator, 
this is true when CMAKE_BUILD_TYPE=Release.  Correct?  Doesn't work for me:
 

Run Script
==========
steve at riemann{build}rm -rf * 
steve at riemann{build}cmake --version 
cmake version 3.6.2 

CMake suite maintained and supported by Kitware (kitware.com/cmake). 
steve at riemann{build}cmake -D CMAKE_BUILD_TYPE=Release .. 
-- The C compiler identification is GNU 6.2.0 
-- The CXX compiler identification is GNU 6.2.0 
-- Check for working C compiler: /usr/bin/cc 
-- Check for working C compiler: /usr/bin/cc -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Detecting C compile features 
-- Detecting C compile features - done 
-- Check for working CXX compiler: /usr/bin/c++ 
-- Check for working CXX compiler: /usr/bin/c++ -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
-- Detecting CXX compile features 
-- Detecting CXX compile features - done 
-- Configuring done 
-- Generating done 
-- Build files have been written to: /home/steve/src/test/cmake/build 
steve at riemann{build}make 
steve at riemann{build}make test 
Running tests... 
Test project /home/steve/src/test/cmake/build 
No tests were found!!! 
steve at riemann{build}
==========

Where am I going wrong?


Thanks!
-Steve

P.S.  After writing this, I discovered that "ctest -C Release" will run the 
tests as desired.  Why doesn't simple "make test" work?



More information about the CMake mailing list