[CMake] altering RUN_TESTS post-build command (MSVC + CTest)

Keith Gunderson krgkg at yahoo.com
Mon Sep 20 12:07:34 EDT 2010


I'm using a MSVC 9.0 Generator with Cmake 2.8.2

How do I add a change so that the command for my RUN_TESTS project changes from 
the default of:

"C:\Program Files\CMake 2.8\bin\ctest.exe" --force-new-ctest-process  -C 
$(OutDir)
if errorlevel 1 goto VCReportError

to

"C:\Program Files\CMake 2.8\bin\ctest.exe" --force-new-ctest-process  -VV -C 
$(OutDir)
if errorlevel 1 goto VCReportError


My CMakeLists file has the following sections (I've omitted un-interesting 
items):


cmake_minimum_required (VERSION 2.6)
set(Boost_ADDITIONAL_VERSIONS "1.42" "1.42.0" "1.43" "1.43.0" "1.44" "1.44.0")
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS   ON)

project (SomthingCalc)
#convienent way to handle gtest so that the 5 gtest locations
#list below don't have to be set within cmake
#use of this assumes a folder layout such that 'include', 'Debug', and
#'Release' are subfolders of IDT_GTEST_ROOT and contain the neede files
set(IDT_GTEST_ROOT "NOTFOUND" CACHE PATH "root for gtest" )
if( NOT IDT_GTEST_ROOT EQUAL "NOTFOUND")
  set( GTEST_INCLUDE_DIR   ${IDT_GTEST_ROOT}/include )
  set( GTEST_LIBRARY  ${IDT_GTEST_ROOT}/Release/gtest.lib )
  set( GTEST_MAIN_LIBRARY  ${IDT_GTEST_ROOT}/Release/gtest_main.lib ) 
  set( GTEST_LIBRARY_DEBUG  ${IDT_GTEST_ROOT}/Debug/gtest.lib )
  set( GTEST_MAIN_LIBRARY_DEBUG  ${IDT_GTEST_ROOT}/Debug/gtest_main.lib  )
endif() 

set(BOOST_ROOT "C:/boost_1_43_0" CACHE PATH "root for boost")
find_package( Boost 1.41.0 COMPONENTS  filesystem system REQUIRED )

enable_testing()                                       
find_package(GTest REQUIRED)                           
include_directories(${GTEST_INCLUDE_DIRS})                     

#threads needed for gtest in linux
if(NOT MSVC)
  find_package(Threads)
endif(NOT MSVC)

if(Boost_FOUND)
  include_directories(${Boost_INCLUDE_DIRS})

  #Keith's unit tests that use the regular 'database'
  add_executable(KeithGtestRegular 
    unittestElements.cpp
            ...
    )
  target_link_libraries(KeithGtestRegular   ${GTEST_BOTH_LIBRARIES})
  target_link_libraries(KeithGtestRegular   
    ${Boost_LIBRARIES}
    )
  if (CMAKE_USE_PTHREADS_INIT)
    target_link_libraries(KeithGtestRegular  ${CMAKE_THREAD_LIBS_INIT})
  endif()

  add_test(RegularGtests KeithGtestRegular  
"--gtest_output=xml:RegularTests.xml" ) 


endif()


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100920/54314331/attachment.htm>


More information about the CMake mailing list